Message384891
Just use the new @cache decorator.¹ It's cleaner looking in code and already sets maxsize to None, making it perfect for your application.
With respect to the proposed optimization, I'm sorry but further optimization of this already fast special case isn't worth the added complexity. It is almost certain that these few nanoseconds won't ever matter in a real application. The @cache decorator is already faster than calling an empty function, "def f(): return None".
¹ https://docs.python.org/3/library/functools.html#functools.cache |
|
Date |
User |
Action |
Args |
2021-01-12 05:40:32 | rhettinger | set | recipients:
+ rhettinger, vstinner, python-dev, eltoder, serhiy.storchaka |
2021-01-12 05:40:32 | rhettinger | set | messageid: <1610430032.15.0.426289662968.issue42903@roundup.psfhosted.org> |
2021-01-12 05:40:32 | rhettinger | link | issue42903 messages |
2021-01-12 05:40:32 | rhettinger | create | |
|