Message285056
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:57 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger |
2017-01-09 17:13:57 | serhiy.storchaka | set | messageid: <1483982037.43.0.625807575084.issue29216@psf.upfronthosting.co.za> |
2017-01-09 17:13:57 | serhiy.storchaka | link | issue29216 messages |
2017-01-09 17:13:57 | serhiy.storchaka | create | |
|