[Python-ideas] Counter comparison

Antony Lee antony.lee at berkeley.edu
Sat Nov 22 00:55:30 CET 2014


As Counter objects effectively behave like multi-sets, it seems reasonable
to overload <, <=, >, >= as for set objects to check whether a Counter is a
sub/super-set of another Counter:

c < d  <===>  all(c[k] < d[k] for k in c)

Thoughts?

Antony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141121/b917cf54/attachment.html>


More information about the Python-ideas mailing list