Callable modules?
Martin v. Loewis
martin at v.loewis.de
Mon Jul 22 16:32:05 EDT 2002
Paul Rubin <phr-n2002b at NOSPAMnightsong.com> writes:
> martin at v.loewis.de (Martin v. Loewis) writes:
> > You can put a callable object in sys.modules. Module objects
> > themselves are not callable.
>
> Is this documented somewhere? I don't see it in the obvious places.
sys.modules is documented in the import statement, which also
documents that further imports will first look in sys.modules. A few
places mention that sys.modules is a dictionary; from that, it follows
that you can modify it. Then, it also follows that if you put a
callable object into sys.modules, that you can call the result of an
import.
Regards,
Martin
More information about the Python-list
mailing list