Module Name Conflicts

torched_smurf at yahoo.com torched_smurf at yahoo.com
Fri Aug 19 02:10:15 CEST 2005


ncf wrote:
> Maybe what you're looking for is __import__()?
>
> >>> help(__import__)
> Help on built-in function __import__ in module __builtin__:
>
> __import__(...)
>     __import__(name, globals, locals, fromlist) -> module
>
>     Import a module.  The globals are only used to determine the
> context;
>     they are not modified.  The locals are currently unused.  The
> fromlist
>     should be a list of names to emulate ``from name import ...'', or
> an
>     empty list to emulate ``import name''.
>     When importing a module from a package, note that __import__('A.B',
> ...)
>     returns package A when fromlist is empty, but its submodule B when
>     fromlist is not empty.

Using this doesn't appear to work any better than regular old import.

-Smurf




More information about the Python-list mailing list