General question about Python design goals
Christoph Zwerschke
cito at online.de
Mon Nov 28 17:54:54 EST 2005
Fredrik Lundh schrieb:
> Christoph Zwerschke wrote:
>
>>What about design goals such as:
>>
>>- orthogonality
>>- coherence, consistency
>>- principle of least astonishment ("Python fits my brain")
>>- simplicity ("kiss" principle)
>>- aesthetics, symmetry
>>
>>Actually, which priority have the above design goals for Python? Are
>>other design goals considered more important?
> - A Foolish Consistency is the Hobgoblin of Little Minds
> - Hypergeneralization Sucks
Ok, these are nice aphorisms with some truth. But I had to think of the
German excuse "Wer Ordnung hält ist nur zu Faul zum Suchen - ein Genie
überblickt das Chaos." ("Those who try to keep things tidy are just too
lazy to search for searching - a genius surveys the chaos").
They remind you that consistency - as every good goal - can be
overemphasized and exaggerated on the cost of other good goals, but
otherwise they have little wisdom in the realm of programming.
In the original context (http://www.emersoncentral.com/selfreliance.htm)
and IIUC, the meaning of the "foolish consistency" aphorism is:
"A great mind will not stupidly think/work consistently from one day to
the next, but is able to throw away beloved ideas, beliefs, habits,
styles etc. if he/she finds something that is better, more true or more
appropriate under changed circumstances."
Try to transfer this to programming languages: "A great programming
language does not have to function consistently from one version to the
next, you can completely throw away a well-established syntax if you
find something better." I think this would not really be desirable.
Another problem I have with that aphorisms applied to Python is that it
has some undertone of "Python is only intended to be used by great
minds" and making it usable and understandable for "little minds" is no
design goal at all. That would be a very arrogant and elitarian view.
Little minds like me should be able to say "Python fits my brain" just
as great minds. Even kids can understand Python (there's a Germany book
"Python for Kids", http://www.way2python.de/pythonbuch/kids.html) and I
think i's not disqualifying Python as a "toy language", but I consider
it rather a strength of Python. Ok, there is even a book "C++ for kids",
but I think in reality it is intended for adult beginners...
Most of all, such solgans do not explain *when* consistency is to be
considered foolish and when it is wise. Are those who suggest changes in
order to make Python more consistent with itself foolish or are those
foolish who reject this, saying that "Python has always been like that,
nobody has cared in the past and we want to stay compatible". This could
be also considered a "foolish consistency".
A programming language is not a "work of art". If you are an artist, you
may break symmetry and introduce all kinds of unexpected effects.
Actually, as an artist, you purposfully want to provoke astonishment.
But if I am using a programming language or a user interface, I don't
want to be confronted with inconsistent behavior. Here, the "principle
of least astonishment" is much more helpful (in my little mind's humble
optionion).
-- Christoph
More information about the Python-list
mailing list