Timing Difference: insert vs. append & reverse

Tim Peters tim.peters at gmail.com
Fri Aug 6 10:34:48 EDT 2004


[Bryan Olson, on deques & Python's list type]
...
> Agreed.  But those Perl wizards, misguided as they may be, are
> pretty sharp.

Yup.

...

[Tim]
>> You can pursue it if you want to, but with the 2.4 deque type I have
>> no interest in messing more with the list type.

[Bryan]
> I'm talking about facilities and their implementations, not people.

Sure!  I'm one of the handful of people who might actually "do
something" about this kind of issue, and I was telling you that I
won't.  Your chances of seeing what you suggest are highly correlated
with finding someone who will "do something" <wink>.  I don't know
whether Raymond Hettinger is interested in pursuing this further, but
if he isn't either (that's my guess), then the only realistic chance
is if you do the work yourself.

> True, when I pointed out that Perl nails this one,

Which part I disagree with, for reasons already given.

> I was kinda' thinking the comparison might motivate Pythoners to
> pursue the same enhancement.

And the desire for efficient "both ends" operation led to 2.4's deque
type, which isn't "the same" enhancement because it didn't end up in
the base list type, but is a better enhancement for people who truly
need both-ends performance.

> It was certainly *not* meant to deride anyone who contributed to implementing
> Python.

I didn't read it that way.

> Is Tim the superior Pythoner?  Duh.  Does Python rock?  Sure.
> Is saving four-or-eight bytes more or less valuable than
> providing efficient insert at both ends?

In the basic list type, yes, it's more valuable in Python to save the
8 bytes.  The speed of "left end" insert/remove is insignificant for
most Python apps, and is quite fast anyway for small lists.  It's a
major concern for *some* Python apps, and the deque type serves those
better than fudging the list type could.  The majority who don't care
don't pay for it.

> With all due respect to Python and the people who implemented it, Perl kicks
> on this one.

I agree that Perl has a good approach here.  I think Python's is better, though.



More information about the Python-list mailing list