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

Jim Jewett jimjjewett at gmail.com
Fri Nov 9 16:20:11 CET 2007


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)

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