[Python-Dev] replacing 'global'

Guido van Rossum guido at python.org
Mon Oct 27 21:55:57 EST 2003


> If we adopt a method of nonlocal assignment that allows the
> deprecation of "global", then we have a chance to change this,
> if we think that such "at-a-distance" rules are undesirable
> in general.
> 
> Do we think that?

Alex certainly seems to be arguing this, but I think it's a lost cause.

Even Alex will have to accept the long-distance effect of

  def f():
      x = 42
      .
      . (hundreds of lines of unrelated code)
      .
      print x

And at some point in the future Python *will* grow (optional) type
declarations for all sorts of things (arguments, local variables,
instance variables) and those will certainly have effect at a
distance.

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



More information about the Python-Dev mailing list