is there a nmore pythonic way ?

Erik Max Francis max at alcyone.com
Fri Mar 14 05:44:16 EST 2003


Shagshag wrote:

> but my question was more about :
> 
> exec("from %s import %s" % (im, func))
> 
> and i wondered if there were better ways to do it and which was best
> (using __import__ maybe ?)

Yep.

	help(__import__)

The `fromlist' argument is for specifying the targets of a "from ...
import ..." import.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Isn't the best defense always a good attack?
\__/ Ovid
    Computer science / http://www.alcyone.com/max/reference/compsci/
 A computer science reference.




More information about the Python-list mailing list