How do I do this? (eval() on the left hand side)

Peter Hansen peter at engcorp.com
Fri Dec 10 16:38:35 EST 2004


Carl Banks wrote:
> Nick Coghlan wrote:
>>to that module is far more evil than playing with globals() ;)
> 
> I'd say using globals() is far eviler.  

I don't understand either of you. ;-)

 From my point of view, they're basically identical, and
although I find Carl's approach slightly less explicit
and harder to read (mainly the uncommon __import__ call,
but it's not a big deal), I can't see why either of them
would be considered evil.

Changing a module's contents via globals() is a very common
and surely benign thing to do.

-Peter



More information about the Python-list mailing list