[issue22515] Implement partial order on Counter

Ethan Furman report at bugs.python.org
Wed Oct 1 19:35:49 CEST 2014


Ethan Furman added the comment:

I have to disagree.  The intent is clearly expressed in the docs [1].  However, if I have a need to deal with partial amounts (say, 2.5 apples because I gave half of one to my horse ;), Counter will still work with that:

  --> treats = Counter({'carrots':12, 'apples':3, 'sugar_cubes':100})
  --> treats
  Counter({'sugar_cubes': 100, 'carrots': 12, 'apples': 3})
  --> treats['apples'] -= 0.5
  --> treats
  Counter({'sugar_cubes': 100, 'carrots': 12, 'apples': 2.5})

At least, it will until we fix that bug.  ;)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22515>
_______________________________________


More information about the Python-bugs-list mailing list