[Python-Dev] Intricacies of calling eq (original) (raw)
Maciej Fijalkowski fijall at gmail.com
Tue Mar 18 08:52:05 CET 2014
- Previous message: [Python-Dev] cpython: Add a stub "whatsnew in 3.5" document.
- Next message: [Python-Dev] Intricacies of calling __eq__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi
I have a question about calling eq in some cases.
We're thinking about doing an optimization where say:
if x in d: return d[x]
where d is a dict would result in only one dict lookup (the second one being constant folded away). The question is whether it's ok to do it, despite the fact that it changes the semantics on how many times eq is called on x.
Cheers, fijal
- Previous message: [Python-Dev] cpython: Add a stub "whatsnew in 3.5" document.
- Next message: [Python-Dev] Intricacies of calling __eq__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]