__import__ with dict values

Lie Ryan lie.1296 at gmail.com
Fri Mar 13 07:46:57 CET 2009


Gabriel Genellina wrote:
> En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy 
> <aleksandr.goretoy at gmail.com> escribió:
> 
>>> note i would still like to be able to do __import__("sys")."path"
> 
> p = __import__("sys").path
> 
> That's a convoluted way of doing:
> 
> import sys
> p = sys.path
> 
> (except that the latter one inserts "sys" in the current namespace)

That's a convoluted way of doing:

from path import sys

(except that the latter one doesn't insert sys in the current namespace)



More information about the Python-list mailing list