Simple questions re name spaces
Cynthia Webber
da57thJones at worldnet.att.net
Fri May 12 20:23:48 EDT 2000
I'm new to Python and have two simple questions requiring namespaces.
1>
I have written a module that defines several constants used throughout out a
project.
Currently when importing these constants into another module I am explicitly
listing each constant
from constants import A
from constants import B
from constants import C
.... .... ... ... ..
Is there a way to expose all of the constants without explicitly listing
them ?
2>
I have tried to dynamically create variables with code such as
>>> a = "b = 'dog'"
>>> exec a
>>> print b
'dog'
This works from the command line but when I included it in a module it
fails.
The exec line executes without complaint, but the newly created variable b
does not seem to exists ? Any Ideas
Thanks In Advance
More information about the Python-list
mailing list