@lru_cache on functions with no arguments

Thomas Nyberg tomuxiong at gmx.com
Tue Aug 1 09:10:45 EDT 2017


On 08/01/2017 02:50 PM, tom at tomforb.es wrote:
> 2. Django has a long-standing no-dependencies rule, which may change in the near future but for now it is stdlib only. We can't add a dependency on `lazy-property`.
Apologies for continuing going off-topic, but the actual code in that
package I linked appears to be about 40 lines. It's MIT-licensed, so you
could just embed it in your code. In fact, I only linked that because it
was easily accessible by pip. I personally have used similar versions in
the past that were much shorter (presumably missing some features in the
package I linked though). For example, I know at some point I used some
variation of this (~11 lines):

https://github.com/columbia-applied-data-science/rosetta/blob/master/rosetta/common.py#L24-L35

But I do respect the distaste for adding a dependency on something so
small. :)

Cheers,
Thomas



More information about the Python-list mailing list