This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients eltoder, python-dev, rhettinger, serhiy.storchaka, vstinner
Date 2021-01-12.05:40:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610430032.15.0.426289662968.issue42903@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-01-12 05:40:32rhettingersetrecipients: + rhettinger, vstinner, python-dev, eltoder, serhiy.storchaka
2021-01-12 05:40:32rhettingersetmessageid: <1610430032.15.0.426289662968.issue42903@roundup.psfhosted.org>
2021-01-12 05:40:32rhettingerlinkissue42903 messages
2021-01-12 05:40:32rhettingercreate