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 serhiy.storchaka
Recipients rhettinger, serhiy.storchaka
Date 2017-01-09.17:13:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483982037.43.0.625807575084.issue29216@psf.upfronthosting.co.za>
In-reply-to
Content
The first patch fails with e.g. tuple subclasses.

The optimization is correct only for types not comparable with tuples. Tuple subclasses are comparable, and classes with custom __eq__ can be comparable. Thus the optimization should be used only for exact builtin types that are known not comparable with tuples. Of course it makes sense only for hashable types.

First than commit something like the second patch I would gather statistics. What are the most used types of the single positional argument of lru-cached functions? Is it worth to apply the optimization for bytes or None? Checking type in C is cheaper than in Python, we can use more types.
History
Date User Action Args
2017-01-09 17:13:57serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger
2017-01-09 17:13:57serhiy.storchakasetmessageid: <1483982037.43.0.625807575084.issue29216@psf.upfronthosting.co.za>
2017-01-09 17:13:57serhiy.storchakalinkissue29216 messages
2017-01-09 17:13:57serhiy.storchakacreate