nested scopes

Nicola Kluge NKluge at
Sun Feb 17 14:11:30 EST 2002

I installed 2.1.2 binary but I can't get this to work

>>> from __future__ import nested_scopes
>>> def B():
            spam = 'bacon'
            def C():
                  print "spam comes with %s" % (spam)

SyntaxError: local name 'spam' in 'B' shadows use of 'spam' as global in
nested scope 'C' (<pyshell#1>, line 1)

I thought that once I imported nested_scopes I would be able to define
function B.

More information about the Python-list mailing list