[Python-Dev] FIFO data structure? (original) (raw)

Jeremy Fincher fincher.8@osu.edu
Sun, 20 Apr 2003 05:16:01 -0400


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

2.3 seems to focus somewhat on adding a wider variety of data structures to Python -- well, sets and heapq, at least :) One thing I've found lacking, though, is a nice O(1) FIFO queue -- even the standard Queue module underlying uses a list as a queue, which means the dequeue operation is O(N) in the size of the queue. I'm curious what the possiblity of getting a queue module (which would probably have to be named "fifo", since Queue is already taken and some operating systems use case-insensitive filesystems) added to the standard library would be.

If it is a possibility, I have a pure-Python implementation using the mechanism described at
<http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=a23cjl%24dps%241%40serv1.iunet.it>.
The module itself is at <http://www.cis.ohio-state.edu/fifo.py>; the tests are at <http://www.cis.ohio-state.edu/test_fifo.py>.

Jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+omVRqkDiu+Bs+JIRAilOAKCWe7CfZqyBboi/zGZ5jHxnKSiS5ACfTBEt D2Hz+k7dzXTW3HjXByzlA2M= =juHN -----END PGP SIGNATURE-----