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

Overload etag/etagger (and other potential pairs, e.g.: key/keyer) #5

Open
mikeboers opened this issue Feb 20, 2013 · 2 comments
Open

Comments

@mikeboers
Copy link
Owner

If we restrict the types that are allowed to be used as etags (and/or user-specified keys, see #4), then we could allow either a scalar etag or a function to create said etag to be passed via the same etag kwarg.

Potential set of types could be:

  • strings
  • ints
  • bools
  • None
  • tuples of these

Basically, hashable builtin types.

@mikeboers
Copy link
Owner Author

Also, overload the methods on a decorated function to be used as decorators themselves:

@memo
def myfunc(a, b):
    pass

@myfunc.etag
def myfunc(a, b):
    return str((a, b))

Just need a relatively comprehensive iscallable to do the detection, since we have already declared that memoized callables may only use hashable arguments.

@mikeboers
Copy link
Owner Author

Would be great if this would also support direct assignment:

myfunc.etag = common_etagger

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

No branches or pull requests

1 participant