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

docs: some imports are omitted #295

Closed
kuraga opened this issue Feb 16, 2024 · 8 comments
Closed

docs: some imports are omitted #295

kuraga opened this issue Feb 16, 2024 · 8 comments
Assignees

Comments

@kuraga
Copy link
Contributor

kuraga commented Feb 16, 2024

Hello! Thanks for your work!

Some imports are not displayed in the docs:

import operator
from cachetools import cached, cachedmethod, LRUCache, TLRUCache, TTLCache

But they are used there.

P.S. Get rid of the one usage of the operator? It would be simpler.

@kuraga kuraga added the bug label Feb 16, 2024
@tkem
Copy link
Owner

tkem commented Feb 25, 2024

@kuraga Thanks for the input! Examples generally assume from cachetools import *, I guess that's more or less in line with Python's standard docs, e.g. https://docs.python.org/3/library/functools.html
Regarding operator, that maybe should be stated explicitly. What's your issue with operator, i.e. how could this be made "simples"?

@kuraga
Copy link
Contributor Author

kuraga commented Feb 25, 2024

@tkem ,

@cachedmethod(lambda self: self.cache)

is more understoodable (in that context) IMHO than

@cachedmethod(operator.attrgetter('cache'))

and doesn't imply (another) implicit import operator.

@tkem
Copy link
Owner

tkem commented Feb 25, 2024

@kuraga You may have a point here ;-) I'll think about it, thanks!

@kuraga
Copy link
Contributor Author

kuraga commented Feb 25, 2024

Ok, have a nice day! :)

@tkem
Copy link
Owner

tkem commented Feb 25, 2024

Would you care to make a pull request for that?

@cachedmethod(lambda self: self.cache)

Sounds pretty reasonable ;-)

@kuraga
Copy link
Contributor Author

kuraga commented Feb 25, 2024

'll make tomorrow both of them.

@kuraga
Copy link
Contributor Author

kuraga commented Feb 26, 2024

Would you care to make a pull request for that?

@cachedmethod(lambda self: self.cache)

Sounds pretty reasonable ;-)

Pushed in #297.

@tkem
Copy link
Owner

tkem commented Feb 26, 2024

Merged #297 into master, thanks!

@tkem tkem closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants