[Python-ideas] Globalize lonely augmented assignment

Georg Brandl g.brandl at gmx.net
Sun Jun 13 12:16:08 CEST 2010

Am 13.06.2010 02:49, schrieb Greg Ewing:
> Georg Brandl wrote:
>> Yes, but why does that make the current semantics broken?
> The current semantics perversely make certain code useless
> that would otherwise have an obvious and useful interpretation.

While introducing a special case.

> Maybe "suboptimal" would be a better adjective.

Yes, I wouldn't argue against that, since it allows for subjectiveness :)

>  >Am 12.06.2010 21:40, schrieb Bruce Frederiksen:
>  >>
>>>    def foo():
>>>        # without an assignment to 'a', this is currently always an error!
>>>        # it can only make sense if 'a' is global!
>>>        a += 7
>>>If you can't do that, then this is a bug!
>> Yes, it is a bug -- a bug in your code.
> But if the programmer intended a to be global, the *only*
> reason it's a bug is the current somewhat arbitrary
> interpretation placed on the augmented assignment.

Hmm, I would call it consistent rather than arbitrary.


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