Why self?

Erik Max Francis max at alcyone.com
Sat Jul 6 15:56:28 EDT 2002


Brian McErlean wrote:

> I don't entirely agree.  The thing that really irritates me about
> hungarian notation is that you're mangling the human readable names of
> things to provide information that is related to the internals of the
> language.

The real problem with Hungarian notation, as far as I'm concerned, is
that the solution is worse than the disease.  I have never seen a
non-trivial project that used Hungarian notation that did not do so
incompletely, inconsistently, and in many cases incorrectly (variables
have Hungarian notations that are incorrect).  Changing the type (or
purpose, depending on how strictly you use Hungarian notation) of one
variable results in a cascade effect, often so substantial that people
don't bother changing the annotations when a variable changes its
type/purpose, meaning that rapidly many of them become inconsistent.

Since the idea behind Hungarian notation is that you can simply look at
a variable and tell its type (or what it's for) without having to look
up a declaration (in C, C++, Java, etc.), this defeats the whole purpose
-- you can never really be sure that the Hungarian annotations are
accurate (since they often aren't), so you end up having to defer to the
declaration anyway.  The entire point of Hungarian notation just
collapsed in on itself.

Hungarian notation with Python seems almost worse, since there is no
authoritative declaration to defer to when you're not sure if an
annotation is accurate or not.

All of the benefits and none of the drawbacks of Hungarian notation can
be gained simply by giving variables appropriate and meaningful
human-readable names.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ See the son in your bad day / Smell the flowers in the valley
\__/ Chante Moore
    Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
 A personal guide to Aliens vs. Predator 2.



More information about the Python-list mailing list