[Python-ideas] Proposal for extending the collections module - bags / multisets, ordered sets / unique lists
Daniel Stutzbach
daniel at stutzbachenterprises.com
Sun Jul 19 16:22:59 CEST 2009
On Sat, Jul 18, 2009 at 8:45 PM, Raymond Hettinger <python at rcn.com> wrote:
> On Jul 17, 2009, at 6:54 PM, Michael Lenzen wrote:
>
>> In a nutshell, I want to add 2 new classes (and respective frozen
>> varients) to the collections module, namely a bag (multiset) class and a
>> setlist (ordered set/unique list) class. I know this has been floated
>> before, but I think it merits more consideration.
>>
>
> FWIW, my goal for the collections module is to keep it relatively small and
> not to include every variant someone can think of. We've already rejected
> red-black trees, pairing heaps, and blist (which is a list variant that
> allows fast insertions).
>
Michael Lenzen:
If you're interested in maintaining a more extensive collections module on
PyPi, I'd be happy to collaborate with you as the author of 2 of the 3
aforementioned rejected data structures. :-)
In addition to pairing heaps (deprecated) and blist (on PyPi), I've also got
a few other data structures that may or may not interest you:
- HeapDict (on PyPi): a dictionary where .popitem() returns the item with
the lowest value
- LRU: a dictionary that maintains hard references to the most recently used
n items and weak references to the rest
- MultiValueDict: x[5] = 1, x[5] = 2, print x[5] => set([1,2])
- WeakRefSet: the set analog to a WeakRefDict
--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090719/d21b838a/attachment.html>
More information about the Python-ideas
mailing list