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

Boris Borcic bborcic at gmail.com
Fri Nov 9 18:29:43 CET 2007

Jim Jewett wrote:
> On 11/9/07, 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.
> Agreed.
> Whether it is worth the costs is a different question.  I'm not sure
> it is, and I'm sure it isn't with this particular syntax.
>> 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.
> There are plenty of tools (and plenty of eyes, including mine) that
> don't use the full ruleset.
> A parenthesis inside a string has no syntactic meaning.  In practice,
> it still messes up some syntax colorings.
>     (1, 2, """3, 4)
> """, 5)

Point was, in a syntactically correct program, the proposed operator can not 
occur /at all/ inside the span of an opened parenthesis, so this type of 
confusion isn't possible.

> I don't think there is any reason to encourage the use of unmatched
> parentheses for any purpose.
> -jJ

More information about the Python-ideas mailing list