[Python-Dev] inplace operators and setitem (original) (raw)
Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Wed Sep 28 17:15:56 CEST 2005
- Previous message: [Python-Dev] inplace operators and __setitem__
- Next message: [Python-Dev] inplace operators and __setitem__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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[0] |= set([1])
changes s in spite of raising TypeError.
Reinhold
-- Mail address is perfectly valid!
- Previous message: [Python-Dev] inplace operators and __setitem__
- Next message: [Python-Dev] inplace operators and __setitem__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]