Raymond Hettinger <raymond.hettin...@gmail.com> added the comment: 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 ---------- nosy: +rhettinger resolution: -> rejected stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42903> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com