Nicier code for this?

Oleg Broytmann phd at phd.fep.ru
Mon May 21 07:14:38 EDT 2001


On Mon, 21 May 2001, Roman Suzi wrote:
> I know exec is not very nice, but I am not sure if something
> better exists for the following:
>
> fake, v = {}, {}
> exec """from mod_%s import func""" % modname in fake, v
> return v["func"](args)

   Just use builtin function __import__, import hooks etc...

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list