From: D Crimbchin <jythoncrimbchin@ho...> - 2003-03-14 08:20:49
There seems to be a difference in running the following code in Jython and
... test1 = 9
... def t2():
... print test1
... return t2
>>>t = t1()
in CPython, this gives me the result I expect, 9.
in Jython, defining t1 gives me a SyntaxWarning (local name 'test1' in 't1'
shadows use as global in nested scopes) and evaluating t() causes a
NameError exception (test1).
So in Jython, how can a function use variables that are defined in enclosing
MSN 8 with e-mail virus protection service: 2 months FREE*