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

Boris Borcic bborcic at gmail.com
Fri Nov 9 18:24:49 CET 2007


Fredrik Johansson wrote:
> On Nov 9, 2007 3:39 PM, Boris Borcic <bborcic at gmail.com> wrote:
>> Title says it all. Got used to += et al. My mind often expects augmented
>> assignment syntax to exist uniformly for whatever transform.
>>
>> If I am not mistaken, python syntax doesn't permit augmented assignment
>> operators to sit between parens so that )= wouldn't risk confusing quick
>> machine- or eye-scans to match parens.
> 
> Would the statement
> 
> ( x )= f
> 
> represent the ordinary assignment x=f or would it become a syntax error?

Ah, indeed I almost itemized my remark about current python syntax with a (1), 
to add a "(2) makes closing parens before an augmented assignment (part of) a 
superfluous construct".

I'd make it a syntax error, to answer your question. I'd be interested in 
examples out of the "wild".

Cheers, BB

> 
> Fredrik




More information about the Python-ideas mailing list