accesibility of the namespace

Petr Jakes petr at tpc.cz
Thu Mar 9 04:42:55 EST 2006


In my code I have relatively wide dictionary definition (about 100
rows).

I would like to put it in to the different file (module) because of the
main code readability (say the name of the file will be
"my_dictionary.py")

In the dictionary I have strings formatted using % operator like:
lcd={2:"Your credit= %3d" % (credit)}

While I am trying to import my_dictionary in to the main code, I am
getting:

exception unhandled NameError
name "credit" is not defined

How can I organize my code so the "credit" variable will be "visible"
in the "my_dictionary" namespace?

Thanks

Petr Jakes




More information about the Python-list mailing list