Costly object creation (was : Having Trouble with Scoping Rules)

bruno at modulix onurb at xiludom.gro
Tue Jan 31 04:44:28 EST 2006

Charles Krug wrote:
> List:
> I've a module that's not doing what I expect.  My guess is that I don't
> quite understand the scoping rules the way I should.
> I have an object that's costly to create.  My thought was to create it
> at the module level like this:


> What's the correct way to do this?
See other answers in this thread for how to solve the UnboundLocalError

Now about your *real* problem - which is nothing new -, you may want to
read about some known solutions:

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