module not callable - why not?
Hung Jung Lu
hungjunglu at yahoo.com
Tue Apr 13 00:25:47 EDT 2004
Jack Diederich <jack at performancedrivers.com> wrote in message news:<mailman.491.1081538569.20120.python-list at python.org>...
>
> - Don't name the module and a class in it the same thing
> import Queue # Queue is a module
> from Queue import Queue # Queue is a class
> ...
To be frank, this problem is just one of the symptoms of a sickened
programming language. Python runs into this problem (like
SimpleXMLRPCServer.SimpleXMLRPCServer) because:
(a) By historical accident, Python modules differ significantly from
regular classes. (Modules are like singleton without constructor for
multiple instantiation, and without property getters/setters.)
(b) Python uses class-based OOP, instead of prototype-based OOP.
Class-based OOP is a historical mistake. If time could be turned back,
I think people would rather start with prototype-based OOP, instead.
Because of this mistake of using class-based OOP, you have incomplete
objects like modules and classes: you usually can't use them directly,
at least not as comfortably/powerfully. Therefore, you find yourself
dealing with names like SimpleXMLPRCServer.SimpleXMLRPCServer, without
being able to collapse instance/class/module into one single object
and one single name.
regards,
Hung Jung
More information about the Python-list
mailing list