None assigment
Rainer Deyke
root at rainerdeyke.com
Thu Feb 8 20:20:58 EST 2001
"Aahz Maruch" <aahz at panix.com> wrote in message
news:95umoi$is5$1 at panix2.panix.com...
> What you're missing is the issue of Python scopes. Try this:
>
> b=2
> def foo():
> b=4
> print b
> del b
> global b
> print b
> foo()
And what *you*'re missing is that whether a variable is local or global is
determined at compile time (in the absensce of 'exec' or 'from ... import
*'). The above does not work. However, Whether a global variable is taken
from the module dictionary or '__builtins__' is a run-time decision.
--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list