On Mon, Mar 8, 2010 at 1:24 PM, Raymond Hettinger <pyt...@rcn.com> wrote:

> Instinct says that conflating two models can be worse for usability
> than just picking one of the models and excluding the other.
>

Toward that end, shouldn't Counter do one (and only one) of the follow?
1) Disallow non-positive counts (like a Multiset/Bag)
2) Allow them when subtracting

In other words, to avoid conflating two models the following two examples
should produce the same output:

>>> c = Counter({'red': 1})
>>> c['red'] -= 2
>>> c
Counter({'red': -1})

>>> c = Counter({'red': 1})
>>> c2 = Counter({'red': 2})
>>> c - c2
Counter()

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to