raymond.hettinger at verizon.net
Mon Jan 26 21:19:55 EST 2004
The collections module is in the sandbox and is almost ready for
If anyone has some time to look at it, I would appreciate it if you
me with any comments or suggestions.
Right now, it only has one type, deque(), which has a simple API
of append(), appendleft(), pop(), popleft(), and clear(). It also
__len__(), __iter__(), __copy__(), and __reduce__(). It is fast,
threadsafe, easy-to-use, and memory friendly (no calls to realloc()
The sandbox includes unittests, a performance measurement tool,
and a pure python equivalent.
I've tried it out with the standard library and it drops in seamlessly
with Queue.py, mutex.py, threading.py, shlex.py, and pydoc.py.
I looked at implementing this as a package, but that was overkill.
If future additions need to be in a separate sourcefile, it is simple
enough to load them into the collections namespace.
To run the sandbox code, type: python setup.py build install
and then at the interactive prompt: from collections import deque
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev