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?
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