What are modules really for?
dan at cellectivity.com
Wed Aug 10 11:05:22 CEST 2005
> Functions existing in a module? Surely if "everything is an object" (OK
> thats Java-talk but supposedly Python will eventually follow this too)
> then there should be nothing in a module thats not part of a class.
No, it's a bit the other way around. In Python, functions are objects:
>>> del MyFunction
>>> def MyFunction(x='abc', y='xyz'): pass
>>> print MyFunction.func_defaults
> Related classes in the same file? Be careful. Doesn't anything "knowing"
> about anything else compromise encapsulation?
You might think of modules in Python as like packages in Java. However,
putting classes in the same module doesn't give them any additional
powers to interact with each other. (At least, not that I know of.)
Distributed computing is like driving a wagon pulled
by a thousand chickens.
- Paul Lindner
More information about the Python-list