Callable modules?
Paul Rubin
phr-n2002b at NOSPAMnightsong.com
Mon Jul 22 01:04:49 EDT 2002
I seem to remember seeing something somewhere about making a module
callable, but I can't seem to find it in the docs. Basically I want
to have a file foo.py, and be able to say (in another file):
import foo
x = foo(3)
instead of having to say foo.mumble(3).
Is there a way to do that? I tried putting
def __call__(x): ...
into foo.py but that didn't work.
If there's not a way to do this already, maybe it's a reasonable
addition.
More information about the Python-list
mailing list