-
Notifications
You must be signed in to change notification settings - Fork 47
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
method support in function_key_generator / function_multi_key_generator #95
Comments
Michael Bayer (zzzeek) wrote: classmethods or instancemethods? the former is very hard. look through the PRs for various handwringing over this. this is why the function is pluggable. |
Wolfgang Schnerring (wosc) wrote: I was thinking of instancemethods. But you're right, individual usecases probably vary a lot, so it's a good thing it's pluggable. |
Michael Bayer (zzzeek) wrote: |
Changes by Michael Bayer (zzzeek):
|
Changes by Michael Bayer (zzzeek):
|
Changes by Michael Bayer (zzzeek):
|
Krishna Vudata (kvudata) wrote: It would be ideal to at least raise an error rather than try to incorrectly handle class methods in |
Michael Bayer (zzzeek) wrote: Can you propose a patch which makes this possible? IIRC the issue is we don't know that this callable is a classmethod or not and we have no way to know what this argument is or not. |
Migrated issue, originally created by Wolfgang Schnerring (wosc)
It would be nice if
function_key_generator
would support methods in addition to plain functions.An example implementation is here: https://github.com/ZeitOnline/pyramid_dogpile_cache2/blob/1.0.1/src/pyramid_dogpile_cache2/cache.py#L26
I haven't found a way to do this other than computing the
namespace
during each function call (instead of only once and storing it in the closure), since at definition time I think you don't have enough information about the function etc. available.The text was updated successfully, but these errors were encountered: