setattr inside a module

Diez B. Roggisch deetsNOSPAM at web.de
Wed Mar 23 07:31:50 EST 2005


> I found this:
> setattr(__import__(__name__), name, value)
> 
> But too much underscores.... Nothing better?
> Marco.

setattr(sys.modules[__name__], name, value)

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list