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

Terry Reedy tjreedy at udel.edu
Sat Jun 9 03:40:42 EDT 2007


"WaterWalk" <toolmaster at 163.com> wrote in message 
news:1181368143.874341.273140 at r19g2000prf.googlegroups.com...
| I've just read an article "Building Robust System" by Gerald Jay
| Sussman. The article is here:
| 
http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf
|
| In it there is a footprint which says:
| "Indeed, one often hears arguments against building exibility into an
| engineered sys-
| tem. For example, in the philosophy of the computer language Python it
| is claimed:

For him to imply that Python is anti-flexibility is wrong.  Very wrong.. 
He should look in a mirror.  See below.

| \There should be one|and preferably only one|obvious way to do
| it."[25] Science does
| not usually proceed this way: In classical mechanics, for example, one
| can construct equa-
| tions of motion using Newtonian vectoral mechanics, or using a
| Lagrangian or Hamiltonian
| variational formulation.[30] In the cases where all three approaches
| are applicable they are
| equivalent, but each has its advantages in particular contexts."

And in those contexts, one would hope that the method with advantages is 
somehow the obvious way to do it.  Otherwise beginners might become like 
Buriden's ass.

So I dispute that science is as different as he claims.  And I do not see 
any real value in the statement in that I do not see it saying anything 
useful to the reader, at least not in this snippet.

| I'm not sure how reasonable this statement is and personally I like
| Python's simplicity, power and elegance. So I put it here and hope to
| see some inspiring comments.

How much has Mr. Sussman actually programmed in Python and what actual 
problems did he find with the *implementation* of the philosophy?  Without 
something concrete, the complaint is rather bogus.

But here is what I find funny (and a bit maddening):  G. J. Sussman is one 
of the inventers of the Lisp dialect Scheme, a minimalist language that for 
some things has only one way to do it, let alone one obvious way.  Scheme 
would be like physics with only one of the three ways.  After all, if they 
are equivalent, only one is needed.

For example, consider scanning the items in a collection.  In Python, you 
have a choice of recursion (normal or tail), while loops, and for 
statements.  For statements are usually the obvious way, but the other two 
are available for personal taste and for specially situations such as 
walking a tree (where one might use recursion to write the generator that 
can then be used by for loops.  In scheme, I believe you just have 
recursion.  Since iteration and recursion are equivalent, why have both?

Terry Jan Reedy






More information about the Python-list mailing list