Skip to main content

General purpose efficient memoization

Project description


The common general versions of memoized decorators ([1], [2], [3]) are often good enough but they incur some overhead that can be avoided in more special cases ([4]). This package exposes a single callable, memoized, that picks an efficient memoization implementation based on the decorated function’s signature and a few user provided options. The included benchmark file gives an idea of the performance characteristics of the different possible implementations.

Additionally, memoized allows:

  • Creating signature preserving decorators (through the decorator module).
  • Passing an external object as the underlying storage (e.g. an LRU cache) instead of a dict that is used by default.

More options for customization and optimization may be added in the future.



  • Add hashable parameter.
  • Make it possible to use @memoized as equivalent of @memoized().


  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for memoized, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size memoized-0.2.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page