[Python-ideas] x )= f as shorthand for x=f(x)

Georg Brandl g.brandl at gmx.net
Fri Nov 9 23:40:49 CET 2007


Terry Reedy schrieb:
> "Boris Borcic" <bborcic at gmail.com> wrote in 
> message news:fh1rhm$ui$1 at ger.gmane.org...
> |
> | Title says it all. Got used to += et al. My mind often expects augmented
> | assignment syntax to exist uniformly for whatever transform.
> 
> I the analogy can be improved.
> 
> x += y # abbreviates
> x = x + y # which could have been defined to have been written
> x = +(x,y) # and which usually *is* equivalent to x = type(x).__add__(x,y)

Hah, I have the solution!

x λ= f

unicode-ly yours,
Georg


-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Python-ideas mailing list