[Python-Dev] SyntaxError: can't assign to function call

Georg Brandl g.brandl at gmx.net
Wed Aug 9 22:55:46 CEST 2006


Guido van Rossum wrote:

>> This is similar to
>>
>> x = ([1], 2)
>> x[0] += [2]
>>
>> which doesn't currently work either, though it could.
> 
> No it couldn't. You can't assign to x[0]. L += R is defined as L =
> L.__iadd__(R) so L must be a valid assignment target.
> 

Thanks for making that clear. I actually had filed a bug about that
behavior (http://python.org/sf/1436226), and from your comment to my
proposed patch I inferred that the report was valid, only the patch
wasn't.

Cheers,
Georg



More information about the Python-Dev mailing list