[Python-Dev] replacing 'global'

Guido van Rossum guido at python.org
Sun Oct 26 22:58:19 EST 2003


[attribution lost]
> > > Ideally, augmented assignments would also become "rebinding". However,
> > > this may have compatibility problems.

[Alex]
> > Unfortunately yes.  It might have been better to define them that way in
> > the first place, but changing them now is dubious.

[Greg]
> I'm not so sure. You need an existing binding before an
> augmented assignment will work, so I don't think there can
> be any correct existing usages that would be broken by this.

Indeed.  If x is neither local not declared global, x+=... is always
an error, even if an x at an intermediate level exists, so THAT
shouldn't be used as an argument against this.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list