packages, globals, and __builtin__
Christian Tanzer
tanzer at swing.co.at
Fri May 11 02:43:55 EDT 2001
Laura Creighton <lac at cd.chalmers.se> wrote:
> I'm making a package, with one class per file name. I want a global
> variable to keep state in which I can access from any module. So I
> import __builtin__ and assign something to __builtin__.StateVariable.
> This works great. But I am feeling squeamish about this. Should I be?
I'd use a module inside the package or the package itself as namespace
for `StateVariable'.
Using __builtin__ will work great as long as nobody else does the same
thing. Then interesting things will start to happen.
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list