variable declaration

Peter Otten __peter__ at web.de
Tue Feb 8 04:33:27 EST 2005


Fredrik Lundh wrote:

> executed. the compiler handles "global" and "from __future__", everything
> else is done at runtime.

and __debug__, too, it seems:

>>> __debug__
False
>>> def f():
...     if __debug__:
...             global x
...     x = 42
...
>>> f()
>>> x
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'x' is not defined

Peter




More information about the Python-list mailing list