[Python-Dev] inplace operators and __setitem__
reinhold-birkenfeld-nospam at wolke7.net
Wed Sep 28 17:15:56 CEST 2005
Phillip J. Eby wrote:
>>A case where this matters is here: http://python.org/sf/1306777
> I've closed it as invalid; the behavior is as-defined.
> In principle, there *could* be an optimization to avoid rebinding the
> lvalue in the case where the __i*__ form did return self. But using it for
> the purpose of allowing augmented assignment to tuple members seems dubious
> at best, and likely to create confusion about the mutability or lack
> thereof of tuples. IMO it's better to have augmented assignment to tuple
> members always fail, so that the code has to be a little more specific
> about its intent.
Okay. I assume that we must accept that
s = set()
t = (s,)
t |= set()
changes s in spite of raising TypeError.
Mail address is perfectly valid!
More information about the Python-Dev