[issue21101] Extend the PyDict C API to handle cases where the hash value is known

Antoine Pitrou report at bugs.python.org
Sat Apr 5 00:18:12 CEST 2014


Antoine Pitrou added the comment:

> PS: Try being a bit more polite.

You could definitely do some research before posting erroneous 
statements (this one isn't difficult to check, as Alex showed). 
Especially when the other posters (Alex and Raymond) are a lot more 
competent than you on the topic at hand.

If you actually try to *reason* about it, there is no other way for:
    x[k] += <some_expr>

to work in the general case than to execute
    x.__setitem__(k, x.__getitem__(k) + <some_expr>)

So, yes, the lookup is done twice, because it currently can't work 
otherwise.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21101>
_______________________________________


More information about the Python-bugs-list mailing list