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

Paul Rubin http
Sun Jun 10 23:18:49 EDT 2007


Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> writes:
> > Not tail calls, in general, no.
> 
> Sorry, how does that work? You're suggesting that there is an algorithm
> which the compiler could follow to optimize away tail-recursion, but human
> beings can't follow the same algorithm?
> 
> Now I'm confused.

The usual compiler method is to translate the code into
continuation-passing style and thereby gain tail-recursion
optimization automagically.  Of course a human could do the same thing
in principle, but it would result in insanely difficult-to-write,
unreadable and unmaintainable code.  At a higher level, there are no
Python features whatsoever, either existing or proposed, that couldn't
be eliminated and left to the human.  Iterators?  While loops?  Who
needs 'em?  We could all go back to programming in machine code.  But
Python is supposed to make programming easier, not harder.  



More information about the Python-list mailing list