[Python-ideas] Reference variable in assignment: x = foo(?)

R. Michael Weylandt michael.weylandt at gmail.com
Thu Jul 11 23:00:08 CEST 2013


On Thu, Jul 11, 2013 at 3:39 PM, Corey Sarsfield <subbarker at gmail.com> wrote:
> I've always found +=, -= and the like to be handy, but I had hoped like so
> many other things in python there would be a generic form of this
> functionality.
>
> x += 5 could be expressed as x = ? + 5 perhaps.
>
>

Can you flesh this out a bit further? Isn't x += 5 <--> x = x + 5
already defined unless a class specifically does something funny with
__iadd__?

Cheers,
Michael


More information about the Python-ideas mailing list