Python's "only one way to do it" philosophy isn't good?

Douglas Alan doug at alum.mit.edu
Tue Jun 19 13:38:28 EDT 2007


"Terry Reedy" <tjreedy at udel.edu> writes:

> The main point of my original post was that the quoted slam at Python was 
> based on a misquote of Tim Peters

But it wasn't based on a "misquote of Tim Peters"; it was based on an
*exact* quotation of Tim Peters.

> and a mischaracterization of Python

I find Sussman's criticism not to be a mischaracterization at all: I
and others have previous mentioned in this very forum our desire to
have (in an ideal world) a good syntax extension facility for Python,
and when we've done so, we've been thoroughly pounced upon by
prominent members of the Python community as just not understanding
the true "Weltanschauung" of Python.  This despite the fact that I
have been happily and productively programming in Python for more than
a decade, and the fact that Guido himself has at times mentioned that
he's been idly considering the idea of a syntax extension facility.

The reason given for why macros wouldn't gel with Python's
Weltanschauung has typically been the "only one obvious way" koan, or
some variant of it.

> and that it was out-of-place in the quoted discussion of physics
> methods and that it added nothing to that discussion and should
> better have been omitted.  *All of this has nothing to do with
> Scheme.*

I'm not sure what you're getting at.  Gerry Sussman has a philosophy
of language design that is different from Python's (at least as it is
commonly expressed around here), and he was using an analogy to help
illuminate what his differences are.  His analogy is completely clear
to me, and, I in fact agree with it.  I love Python, but I think the
"only one obvious way" philosophy may do more harm than good.  It is
certainly used, in my experience, at times, to attempt to squelch
intelligent debate.

> At the end, I added as a *side note* the irony that the purported author 
> was the co-developer of Scheme, another 'minimalist algorithm
> language 

Sussman's statements are not ironic because Scheme is a language that
is designed to be extended by the end-user (even syntactically), while
keeping the core language minimal.  This is a rather different design
philosophy from that of Python.

> (Wikipedia's characterization) with more uniform syntax than Python and 
> like Python, also with one preferred way to scan sequences (based on my 
> memory of Scheme use in the original SICP, co-authored by the same 
> purported quote author, and also confirmed by Wikipedia).

There is no one preferred way to scan sequences in Scheme.  In fact,
if you were to take SICP at MIT, as I did when I was a freshman, you
would find that many of the problem sets would require you to solve a
problem in several different ways, so you would learn that there are
typically a number of different reasonable ways to approach a problem.
E.g., one of the first problem sets would have you implement something
both iteratively and recursively.  I recall another problem set where
we had to find the way out of a maze first using a depth-first search
and then using a breadth-first search.

> | [Steele quote deleted]
> | Do you now see how Scheme's syntax extension mechanism is relevant?

> No.  This just partly explains why Scheme gets away with being
> minimalist.  I explicitly referred to the core language as delivered
> and as used in SICP.

I suggest that you haven't yet grokked the Weltanschauung of Scheme.
Scheme aficionados would not typically insist that a proposed language
feature is not good because it violates anything like an "only one
obvious way" rule.  Rather they would argue that if it can be
implemented as fuctions and/or macros, then it *should* be implemented
that way, rather than polluting the core language.  The new facility
should then be included in a library.

|>oug



More information about the Python-list mailing list