I guess my post was unclear but my intent was indeed Ethan's (can I satisfy an order from my inventory?), not Steven's.

2014-11-23 17:30 GMT-08:00 Ethan Furman <ethan@stoneleaf.us>:
On 11/23/2014 05:20 PM, Steven D'Aprano wrote:
> On Sun, Nov 23, 2014 at 05:03:27PM -0800, Ethan Furman wrote:
>> On 11/23/2014 04:04 PM, Steven D'Aprano wrote:
>>> On Sun, Nov 23, 2014 at 11:30:25AM -0800, Antony Lee wrote:
>>>>
>>>> My goal was very simply to check whether it was possible to remove a
>>>> multi-set of elements from another, without any counts going below 0 (as
>>>> should be the case for "natural" counters).
>>>
>>> Do you mean this?
>>>
>>> py> from collections import Counter
>>> py> c1 = Counter({'a': 5, 'b': 2})
>>> py> c2 = Counter({'a': 1, 'b': 4})
>>> py> c1 - c2
>>> Counter({'a': 4})
>>
>> Um, how does that show that 'b' went below zero?
>
> It doesn't, which is the point. Antony asked for removal WITHOUT counts
> going below zero.

Ah.  I read that as "being able to tell if any count would go below zero" -- as in, counter1 is my inventory, counter2
is an order, can I fill the order?

--
~Ethan~


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/