Zen of Python

Paul Rubin http
Fri Jan 21 01:18:36 EST 2005


Steve Holden <steve at holdenweb.com> writes:
> But how, in Lisp, would you transliterate the Python list [1, 2, 3, 4]?

With a vector.

> Clearly the Python list *is* different, and the tradeoff was to
> obtain speed of random access, presumably (I wasn't taking an interest
> in Python in its early days) anticipating that non-recursive
> algorithms would be the norm.

Python lists and Lisp vectors are generally used in about the same
way.  Sometimes in Lisp people use lists of conses in ways where
Python would use its vector-like lists.  You can still use recursive
algorithms on vectors though you would normally pass extra index info
to avoid copying the vectors all the time.

> > beginning what the final destination is going to be.  So once we can
> > see where it's going, why not proceed to the finish line immediately
> > instead of bothering with the intermediate steps?
> 
> Perhaps because we don't all have your psychic powers?

You snipped out the examples I gave, like [x*x for x in range(5)]
leaving unnecessary residue in the name space.  Was it not obvious
from the beginning that that was a kludge?  If it was obviously
a kludge, was it not obvious that there would be reason to want to
fix it someday?  I'm saying that if some new feature is going to
need a fix later, it's better to fix it before releasing it in
the first place.



More information about the Python-list mailing list