How to have application-wide global objects

Bruno Desthuilliers onurb at xiludom.gro
Thu Jul 13 11:09:11 EDT 2006


Sanjay wrote:
> Probably a newcomer question, but I could not find a solution.
> 
> I am trying to have some singleton global objects like "database
> connection" or "session" shared application wide.

Whenever possible, dont. If you really have no other way out, create the
'singleton' in it's module (at the module's to level), then import the
module.

> Trying hard, I am not even being able to figure out how to create an
> object in one module and refer the same in another one. "import"
> created a new object, as I tried.

I'd like to know what you actually tried.


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list