efficient idiomatic queue?

Jason Orendorff jason at jorendorff.com
Tue Jan 15 11:16:16 EST 2002


David Eppstein wrote:
> In article <mailman.1011063861.31491.python-list at python.org>,
>  "Jason Orendorff" <jason at jorendorff.com> wrote:
>
> > The given operations are usually "quick enough", for small lists
> > (less than, say, 5000 items) since the constant coefficient is
> > small, compared to the ordinary semi-inefficiency of running
> > Python code in the first place.
>
> I'm not sure what you mean by quick enough, but when I tried draining a
> list by repeated del L[0], on lists of 10000 elements it took roughly a
> second -- more time than I'd like to spend in most interactive situations.
>
> My philosophy to writing general purpose code like a sorting
> routine is to use as efficient algorithms as reasonably possible,
> [...deletia...]

All you had to say was, "5000 items won't do it for me.  I want
genuine O(N log N) behavior."

In which case you could have read on to the part of my email where
I suggested L.reverse().

Cheers.

## Jason Orendorff    http://www.jorendorff.com/





More information about the Python-list mailing list