Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

Expand functools features to methods, classmethods, staticmethods and even for (unofficial) hybrid methods.

For now, methodtools only provides methodtools.lru_cache.

Use methodtools module instead of functools module. Than it will work as you expected.

from methodtools import lru_cache

class A(object):

    # cached method. the storage lifetime follows `self` object
    @lru_cache()
    def cached_method(self, args):
        ...

    # cached classmethod. the storage lifetime follows `A` class
    @lru_cache()  # the order is important!
    @classmethod  # always lru_cache on top of classmethod
    def cached_classmethod(self, args):
        ...

    # cached staticmethod. the storage lifetime follows `A` class
    @lru_cache()  # the order is important!
    @staticmethod  # always lru_cache on top of staticmethod
    def cached_staticmethod(self, args):
        ...

@lru_cache()  # just same as functools.lru_cache
def cached_function():
    ...

Installation

PyPI is the recommended way.

$ pip install methodtools
To browse versions and tarballs, visit:

https://pypi.python.org/pypi/methodtools/

See also

Release files for methodtools 0.4.7

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

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for methodtools 0.4.7
File Size Uploaded
methodtools-0.4.7.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for methodtools 0.4.7
File Interpreter ABI Platform
methodtools-0.4.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.6 kB

Release files / methodtools-0.4.7.tar.gz

Download URL methodtools-0.4.7.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e213439dd64cfe60213f7015da6efe5dd4003fd89376db3baa09fe13ec2bb0ba
BLAKE2b-256 checksum
How to use checksums
133bc21b74ac17befdf17b286494b02221b7a84affb1d410ff86e38ba0e14b13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / methodtools-0.4.7-py2.py3-none-any.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL methodtools-0.4.7-py2.py3-none-any.whl
Size 4.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5e188c780b236adc12e75b5f078c5afb419ef99eb648569fc6d7071f053a1f11
BLAKE2b-256 checksum
How to use checksums
b64b6497ffb463b1b75e04b348ef31070606d43e3c503fa295383538ded999c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.4.7 This release

2 release files

0.4.5

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

2 release files

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