[Python-3000] Draft PEP for outer scopes
jan.grant at bristol.ac.uk
Thu Nov 2 10:27:25 CET 2006
On Wed, 1 Nov 2006, Steven Bethard wrote:
> I don't think that'll really be worth it. I'd be amazed if people
> didn't expect it to mean "top-level". The real question is, if people
> see something like this::
> def f():
> n = 0
> def g(i):
> global n
> n += i
> return g
> func = f()
> print func(), func()
> what would they expect it to do?
Set "n" in the scope of "func", assuming func is top-level. That global
is already a lie isn't a feature.
I'd rather see "outer" than "global" but even that can be understood to
mean "outermost" rather than "the next one out".
PS. If you're hunting for keywords to overload to drag variables into scope,
"import" is also available, although would probably be very hard to make
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 http://ioctl.org/jan/
Not as randy or clumsom as a blaster.
More information about the Python-3000