module not callable - why not?

Paul Rubin http
Sun Apr 18 05:28:50 EDT 2004


Josiah Carlson <jcarlson at uci.edu> writes:
> I think of modules as a namespace.  Why?  Because that is what they
> are. They contain a space of names, some of which may be useful to
> you, otherwise you wouldn't have imported the module.

Is a class instance not also a namespace?  After all, it contains a
space of names, some of which you must have wanted or else you
wouldn't have instantiated it.

And yet, you can call a class instance if it has a __call__ operation
defined.  I don't see why modules shouldn't be the same.



More information about the Python-list mailing list