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 <rep...@bugs.python.org>
<http://bugs.python.org/issue21101>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to