[Python-Dev] collections module

M.-A. Lemburg mal at egenix.com
Fri Jan 9 18:07:04 EST 2004


Tim Peters wrote:
> [Josiah Carlson]
> 
>>There's been a python-based FIFO that is O(1) on {push, pop} and uses
>>lists in the ASPN Python cookbook (adding len is easy):
>>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/210459
>>You'd probably be more interested in the variant I posted as a
>>comment; it is significantly faster when the output queue is
>>exhausted.
> 
> Yup!  Yours is the nicest way to build an efficient (but thread-unsafe)
> queue in Python.

FWIW, if you're interested in fast stacks and queues you may
want to have a look at mxStack and mxQueue from the egenix-mx-base
distribution.

They have nothing to do with threads (who needs them anyway
when we have copy-on-write :-).

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 06 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the Python-Dev mailing list