Carl Banks wrote:
Modifying globals() not even necessary for this.  When I want to
dynamically update the global namespace, I do it this way:

mod = __import__(__name__)
setattr(mod,symbol,value)

Works perfectly unless you're worried about someone modifying the built
in __import__.

Well, aside from the detail that modifying a module's contents via a reference to that module is far more evil than playing with globals() ;)


Even if that module is the one you're running in. . .

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to