[Tutor] operator order

eryksun eryksun at gmail.com
Fri Feb 1 04:51:34 CET 2013


On Thu, Jan 31, 2013 at 5:53 PM, Hugo Arts <hugo.yoshi at gmail.com> wrote:
>
>>>> a = ([], [])
>>>> a[0] += [1]
> TypeError: 'tuple' object does not support item assignment
>>>> a
> ([1], [])

Yep, storing the result fails for a read-only subscript or attribute
(e.g. a property without fset), but only after the in-place op
executes. Solution: don't do that. ;)


More information about the Tutor mailing list