[Python-Dev] Collections (original) (raw)
Raymond Hettinger raymond.hettinger at verizon.net
Mon Jan 26 21:19:55 EST 2004
- Previous message: [Python-Dev] Re: PEP 326 (quick location possibility)
- Next message: [Python-Dev] VIRUS U VASOJ PORUCI
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The collections module is in the sandbox and is almost ready for primetime. If anyone has some time to look at it, I would appreciate it if you would email me with any comments or suggestions.
Right now, it only has one type, deque(), which has a simple API consisting of append(), appendleft(), pop(), popleft(), and clear(). It also supports len(), iter(), copy(), and reduce(). It is fast, threadsafe, easy-to-use, and memory friendly (no calls to realloc() or memmove()).
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.
Raymond Hettinger
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... URL: http://mail.python.org/pipermail/python-dev/attachments/20040126/796b5365/attachment.html
- Previous message: [Python-Dev] Re: PEP 326 (quick location possibility)
- Next message: [Python-Dev] VIRUS U VASOJ PORUCI
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]