packages, globals, and __builtin__

Fredrik Lundh fredrik at pythonware.com
Thu May 10 15:53:48 EDT 2001


Laura Creighton 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?

if the style mafia finds out, you may find a badly severed list comprehension
in your bed one morning, but I'd say the risk is very low.  *I* wouldn't do it,
though...

Cheers /F





More information about the Python-list mailing list