General question about Python design goals
cito at online.de
Tue Nov 29 10:55:11 CET 2005
Mike Meyer wrote:
> Christoph Zwerschke wrote:
>>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).
> But a programming language (or UI) is not just a collection of syntax
> and and interfaces - it's an implementation. You need to keep in mind
> that "practicality beats purity". If following POLA makes the
> implementation an order of magnitude slower or larger, then you don't
> follow POLA - at least until you can do it without that cost.
I do not deny this. As an example, if tuples can be used as keys of
dicts, you might first naively assume that lists could also work. This
is not the case for practicality (performance) reasons and because it
would be difficult or impossible to guarantee the uniqueness of keys. In
this case, POLA is overruled by other goals or inherent necessities.
But that does not mean that POLA in itself is not an important guiding
principle for programming languages (or UI).
More information about the Python-list