Author serhiy.storchaka
Recipients rhettinger, serhiy.storchaka
Date 2017-01-09.17:13:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2017-01-09 17:13:57serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger
2017-01-09 17:13:57serhiy.storchakasetmessageid: <>
2017-01-09 17:13:57serhiy.storchakalinkissue29216 messages
2017-01-09 17:13:57serhiy.storchakacreate