A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-August/068086.html below:

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

[Python-Dev] SyntaxError: can't assign to function call [Python-Dev] SyntaxError: can't assign to function callGeorg Brandl g.brandl at gmx.net
Wed Aug 9 22:33:21 CEST 2006
Terry Reedy wrote:
> "Neal Becker" <ndbecker2 at gmail.com> wrote in message 
> news:ebd2sp$nnv$1 at sea.gmane.org...
>> class X (object):
>>    pass
>>
>> X() += 2
>>
>>> SyntaxError: can't assign to function call
>>
>> Suppose I actually had defined __iadd__ for class X.  Python says this
>> syntax is invalid.  I wish is wasn't.
> 
> If you translate to x() = x() +2, with x called just once, it does not make 
> sense.  You can bind to names and slots in compound objects, but not to 
> objects.

This is similar to

x = ([1], 2)
x[0] += [2]

which doesn't currently work either, though it could.

Georg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4