[Python-Dev] Re: FIFO data structure?

Guido van Rossum guido@python.org
Sun, 20 Apr 2003 17:31:03 -0400


[Guido]
> > Also ask yourself the following questions.  How much time are you
> > paying for the overhead of using a class vs. using a list directly?

[Jeremy Fincher]
> I imagine the object would eventually be written in C (probably by someone 
> more experienced than myself, but I could do it if need be), when that 
> overhead shouldn't matter.  But even with a pure-Python implementation, as 
> noted in my other email, the fastest O(1) implementation outran the naive 
> list implementation (granted it was wrapped in a class to maintain the same 
> interface) somewhere between 100 and 1000 elements.  I could find out the 
> average place at which the O(1) implementation becomes faster, if you're 
> interested.

I have to think about this more.  ATM I'm inclined to say that this is
relatively uncommon, and it's not that hard to come up with an
efficient implementation.  Python's philosophy about data types is
that a few versatile data types (list, dict) get most the attention
because they are re-usable in so many places.  When you get to other
algorithms, there is such a variety that it's hard to imagine putting
them all in the standard library; instead, it's easy to roll your own
built out of the standard ones.

> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (FreeBSD)
> 
> iD8DBQE+ox1OqkDiu+Bs+JIRAhvvAJ9gHSRpZmf8F2tCsqK40uSPqIoCMACeM5lY
> k7FInBxUdA3MF/q/Hl4U45U=
> =lb0T
> -----END PGP SIGNATURE-----

I know what this is, but I don't see the point.  I don't know who you
are (don't think we've ever met) and I respond based on your words,
not on who wrote them.  So what's the point?

--Guido van Rossum (home page: http://www.python.org/~guido/)