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/068081.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 callNeal Becker ndbecker2 at gmail.com
Wed Aug 9 18:35:13 CEST 2006
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.

Here's where I might use it.  Suppose I have a container class.  Suppose I
could make a slice of this container, like so:

c = Container()
s = Slice (c, 0, 10)

where "Slice" is a class.  Then:

s += 2

Would perform iadd on the slice of the container.  A convenient syntax would
be:

Slice (c, 0, 10) += 2

Does anyone else think this would be a good addition to Python?


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