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

Douglas Alan doug at alum.mit.edu
Fri Jun 22 20:09:55 CEST 2007


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

> | But why is the ability to abstract syntax good?

> I think this points to where Sussman went wrong in his footnote and
> Alan in his defense thereof.  Flexibility of function -- being able
> to do many different things -- is quite different from flexibility
> of syntax 

I think you are setting up a false dichotomy.  One that is related to
the false unification that annoying people used to always make when
they would perpetually argue that it wasn't important which
programming language you programmed in, as they are all Turing
equivalent anyway.  Well, I sure as hell don't want to write all my
programs for a Turning machine, and a Turing machine is certainly
Turing equivalent!

Functionality is no good if it's too cumbersome to use.  For instance,
Scheme gives you first class continuations, which Python doesn't.
Continuations let you do *all sorts* of interesting things that you
just cannot do in Python.  Like backtracking, for instance.  (Well
maybe you could do backtracking in Python with lots of putting code
into strings and liberal use of eval, for all I know, but the results
would almost certainly be too much of a bear to actually use.)

Now, continuations, by themselves, in Scheme actually don't buy you
very much, because although they let you do some crazy powerful
things, making use of them to do so, is too confusing and verbose.  In
order to actually use this very cool functionality, you need macros so
that you can wrap a pretty and easy-to-use face on top of all the
delicious continuation goodness.

You'll, just have to trust me on this one.  I've written code with
continuations, and I just couldn't make heads or tails out of the code
a few hours later.  But when prettied-up with a nice macro layer, they
can be a joy to behold.

|>oug



More information about the Python-list mailing list