Callable modules?

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Mon Jul 22 02:40:23 EDT 2002


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.

> > If there's not a way to do this already, maybe it's a reasonable
> > addition.
> 
> Maybe not. Why do you need this?

Just to not have to say "foo.foo()" or "from foo import foo".

If the main purpose of the module is to provide one function, I think
it's cleaner to be able to import the module and call the function
without special tricks.



More information about the Python-list mailing list