Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for classmethod decoration #10

Closed

Conversation

swayf
Copy link
Contributor

@swayf swayf commented Jul 31, 2013

added support for classmethods (needed last night :)

what do you think?

@mikeboers
Copy link
Owner

This is a tricky one.

I originally thought that swapping the order of the decorators would work:

@classmethod
@memo
def whatever(cls, ...):
    pass

and this does work for the immediate use case (i.e. returning memoized values), BUT it does not work with the methods on the memoized wrapper (e.g. exists) since they are not affected by the classmethod.

Looking at how you specifically implemented I feel that methods on metaclasses will get caught up, but I'm not too sure. I'm having too hard a time to wrap my head around the intricacies of descriptors today, apparently.

Perhaps the thing to do is to completely special case classmethod, and not try to be smarter about it.

@mikeboers mikeboers deleted the branch mikeboers:master May 21, 2023 21:15
@mikeboers mikeboers closed this May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants