How to use the exec statement

Bengt Richter bokr at oz.net
Sun Oct 6 16:34:37 EDT 2002


On Sun, 06 Oct 2002 20:09:06 GMT, Alex Martelli <aleax at aleax.it> wrote:
[...]
>namespace = {}
># populate dict namespace with whatever you want, e.g.:
>import math
>namespace.update(math.__dict__)
># etc etc
Just a style nit. How about
    namespace.update(vars(math))
?
ISTM all those long underscores look like insider hacks
instead of standard usage, though I realize the __XXX___
convention is pervasive (and hopefully stable ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list