Namespace pollution

Terry Reedy tjreedy at udel.edu
Tue Feb 1 00:31:07 EST 2000


"Gerrit Holl" <gerrit.holl at pobox.com> wrote in message
news:20000131170908.A831 at stopcontact.palga.uucp...
> Dirk-Ulrich Heise wrote on 949329139:
...
> > 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)?
>
> Nest functions.
>
> If you have a function X only used in _one_ other function Y, move the
> function definition X to Y.

The problem with this is that function X is recreated everytime you call
function Y.






More information about the Python-list mailing list