The Single Most Useful Decorator in Python
Video Statistics and Information
Channel: mCoding
Views: 210,261
Rating: 4.9707298 out of 5
Keywords: python, programming, cached, decorator, functools
Id: DnKxKFXB4NQ
Channel Id: undefined
Length: 3min 50sec (230 seconds)
Published: Sat Dec 12 2020
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Interesting
videousername 😁True dat. Just remember that internally, both cache and lru_cache use a dictionary in which the arguments of the function are the key, and the result is the value. So be careful not to use mutable data structures as the arguments.
This is great 👍
Lol. I facepalmed hard when I first learned of this decorator as I spent a ton of time making a custom cache decorator project.
I don’t regret it as I learned a ton, but yes this is a fantastic decorator and everyone should be aware of it and how it works ( really, just know not to use mutable keys).
The cachetools package offers other cache strategies, it's been great. Having a TTLcache is very handy with some applications.