[Python-Dev] PEP 509: Add a private version to dict
Victor Stinner
victor.stinner at gmail.com
Mon Jan 11 18:24:03 EST 2016
More information about the Python-Dev mailing list
Mon Jan 11 18:24:03 EST 2016
- Previous message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2016-01-12 0:07 GMT+01:00 Gregory P. Smith <greg at krypto.org>: >> Changes >> ======= >> >> (...) > > Please be more explicit about what tests you are performing on the values. > setitem's "if the value is different" really should mean "if value is not > dict['key']". similarly for update, there should never be equality checks > performed on the values. just an "is" test of it they are the same object > or not. Ok, done. By the way, it's also explained below: values are compared by their identify, not by their content. For best dict efficiency, we can not implement this micro-optimization (to avoid a potential branch misprediction in the CPU) and always increase the version. But for guards, the micro-optimization can avoid a lot of dictionary lookups, especially when a guard watches for a large number of keys. Victor
- Previous message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list