Patrick Sabin wrote:
Johan Grönqvist schrieb:
Hi All,
I find several places in my code where I would like to have a variable
scope that is smaller than the enclosing function/class/module
definition.
One representative example would look like:
----------
spam = { ... }
eggs = { ... }
ham = (a[eggs], b[spam])
----------
[snip]
1) If you define all this in the global namespace you could remove your
temporary variables afterwards, e.g.
spam = 1
ham = (spam,)
del globals()['spam']
Why use globals()? You could just say
del spam
and be done with it.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list