Zen of Python
steve at holdenweb.com
Thu Jan 20 09:04:00 EST 2005
Paul Rubin wrote:
> Tim Peters <tim.peters at gmail.com> writes:
>>>Huh? [1,2,[3,4,5],[6,[[[],8]]]] is a perfectly valid Python list.
>>You're claiming not to know any relevant difference between Python
>>lists and Lisp lists? Heh.
> Python doesn't provide syntactic sugar for [1,[2,[3,[4,]]]] if
> that's what you mean. In Lisp you'd say (1 2 3 4). It's still
> a perfectly valid list in Python. Python by convention uses
> multi-element arrays instead of lists of conses.
But how, in Lisp, would you transliterate the Python list [1, 2, 3, 4]?
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.
>>>And you can break out of a containing loop from a nested loop
>>Heh heh. Yes, you can. I've never seen a real Python program that
>>did, but there's nothing to stop you.
> I do that on a fairly routine basis. I won't say "often", but it's a
> standard technique that finds a use now and then.
Well, I blush to say I have done that (once, if my memory serves me
correctly), but it was an ugly program, and I did eventually refactor
the code so that the loops were in separate scopes, which made it much
> There's a technique in numerical analysis called Richardson
> extrapolation, where you compute an integral by [...]
Wow. Anyone who feels the need to explain numerical analysis techniques
to Tim Peters is wasting keystrokes big-time. Anyway, Richardson
extrapolation is merely one of many successive approximation techniques,
which is what you are talking about, no?
> I see the same thing happening in Python. It's going through
> successively better approximations to get closer to a limit. Python
> has it harder than some other languages, because it tries to serve the
> needs of both throwaway scripts and large-scale development projects.
> The result is that feature after feature starts out with an
> implementation sufficient for small scripts, and then edges towards
> the needs of large-scale projects. But it's often predictable at the
> 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?
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
More information about the Python-list