Skip to main content

Memoize

Only compute the value of properties the first time they are called. The easiest way to explain it is by example.

Bad:

class Foo(object):
    def __init__(self):
        self._bar_cache = None

    @property
    def bar(self):
        if self._bar_cache is None:
            self._bar_cache = 2 * 2 * 2
        return self._bar_cache

Good:

from memoize import mproperty

class Foo(object):
    @mproperty
    def bar(self):
        return 2 * 2 * 2

Metadata

Release files for memoize 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memoize 1.0.0
File Size Uploaded
memoize-1.0.0.tar.gz 1.1 kB Details

Release files / memoize-1.0.0.tar.gz

Download URL memoize-1.0.0.tar.gz
Size 1.1 kB
Tags Source
SHA-256 checksum
How to use checksums
84ebee45db8347a8abc779d91ec045ae8e6634b4b8b82c6fbbdc8a1f10efd95c
BLAKE2b-256 checksum
How to use checksums
72c223a937cdd947e5b2d724a142cc96934354bad432a7e0128c3d087c918da7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page