Namespace pollution

Moshe Zadka moshez at math.huji.ac.il
Tue Feb 1 04:00:39 CET 2000


On Mon, 31 Jan 2000, Dirk-Ulrich Heise wrote:

> ...
> I've got one problem with all this stuff:
> I end up with dozens of helper functions that are
> called exactly one time. They pollute the namespaces
> of the module or class they're defined in. I hate polluted
> namespaces.
> 
> How do others cope with this problem (that does not only
> apply to Python)?

Well, like the timbot said "namespaces are a honking good idea -- let's do
more of those". Use packages rather then modules, and then all of a
module's helper function stay "private". Use OO -- classes were meant
exactly to reduce namespace clutter by keeping the functions "inside" the
objects.

--
Moshe Zadka <mzadka at geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.





More information about the Python-list mailing list