[Python-Dev] odd "tuple does not support assignment" confusion...

Simon Cross hodgestar+pythondev at gmail.com
Sat Mar 3 00:32:17 CET 2012


l[0] += [1]
is the same as
l[0] = l[0] + [1]
Does that make the reason for the error clearer? The problem is the
attempt to assign a value to l[0].
It is not the same as
e = l[0]
e += [1]
which is the equivalent to
e = l[0]
e = e + [1]
This never assigns a value to l[0].
Schiavo
Simon


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /