MRAB wrote:
While another thread is talking about an ordered dict, I thought I'd
try a simple implementation of a bag/multiset in Python. Comments/
suggestions welcome, etc.
class bag(object):
I would prefer a logical rather than alphs order to the methods.
Certainly, starting with __init__
While another thread is talking about an ordered dict, I thought I'd
try a simple implementation of a bag/multiset in Python. Comments/
suggestions welcome, etc.
class bag(object):
def __add__(self, other):
result = self.copy()
for item, count in other.iteritems():