Namespace pollution

Gerrit Holl gerrit.holl at pobox.com
Mon Jan 31 11:09:08 EST 2000


Dirk-Ulrich Heise wrote on 949329139:
> In the recent whitespace war,
> some people said "Python is such an expressive
> language, you need only short functions.", "don't indent
> too much, that's bad style", even Linus Thorvalds was
> quoted (who likes 1 TAB = 8 spaces indentation to not
> lose control)...
> 
> 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)?

Nest functions.

If you have a function X only used in _one_ other function Y, move the
function definition X to Y.

regards,
Gerrit.

-- 
Please correct any bad Swahili you encounter in my email message!
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----




More information about the Python-list mailing list