[Python-ideas] Proposal for extending the collections module - bags / multisets, ordered sets / unique lists

Michael Lenzen m.lenzen at gmail.com
Sat Jul 18 06:51:49 CEST 2009


A Counter class is NOT a multiset, it allows negative and zero 
elements.  This makes as much sense to me as having negative elements in 
a Set.  This is all besides the fact that Counter is nothing more than 
defaultdict(int) so it should be removed regardless of whether or not 
bags are added.

-Michael Lenzen

On 07/17/2009 09:36 PM, Carl Johnson wrote:
> Excuse my ignorance, but it's been a while since I've taken an
> algorithms class: Would a bag have any Big-O performance advantage
> over just using a list but ignoring the fact that it's in an order?
> Non-big O but otherwise practical speed advantages?
>
> As for the ordered set, there I can see the uses much more clearly,
> and the proposal to included it has come up on this list before. At
> the same time though, I think some of those uses can also be realized
> using the new collections.Counter class. Then again, if there's
> interest, why not?
>
> -- Carl Johnson
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>    



More information about the Python-ideas mailing list