On Wed, 18 Apr 2001 22:31:28 +0200, Just van Rossum wrote: >Modules don't have instances. Sure, modules are in many ways like classes, >but they're not at all like instances. And only with instances the self >discussion becomes interesting. Your analogy is moot. Modules are every bit like instances -- a singleton instance, to be specific. They expose an interface, and maintain state -- just like any object. Internally, they're even represented by the same data structure as an object. What they don't do is inherit functionality from other modules, but even that can be emulated with stuff like: import foo FooFunc1 = foo.FooFunc1 FooFunc2 = foo.FooFunc2 # ... etc... Because they expose an interface, a module can be treated as an instance of a class defined by the global definitions of that module (it's a recursive definition, and this is why other dynamic OO environments have the concept of "meta-classes" as well as classes, so as to break this recursion). -- KC5TJA/6, DM13, QRP-L #1447 Samuel A. Falvo II Oceanside, CA
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4