<div style="margin: 2em 0pt;" name="sig_2341e11ee1">On Mon, Mar 8, 2010 at 1:24 PM, Raymond Hettinger <span dir="ltr"><<a href="mailto:python@rcn.com">python@rcn.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Instinct says that conflating two models can be worse for usability<br>
than just picking one of the models and excluding the other.<br></blockquote><div><br>Toward that end, shouldn't Counter do one (and only one) of the follow?<br>1) Disallow non-positive counts (like a Multiset/Bag)<br>
2) Allow them when subtracting<br><br>In other words, to avoid conflating two models the following two examples should produce the same output:<br><br>>>> c = Counter({'red': 1})<br>>>> c['red'] -= 2<br>
>>> c<br>Counter({'red': -1})<br><br>>>> c = Counter({'red': 1})<br>>>> c2 = Counter({'red': 2})<br>>>> c - c2<br>Counter()<br><br></div>--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</div><br>