You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiset.__delitem__ is untested and appears to be broken: it doesn't update self._total. Maybe it should be implemented as self[element] = 0 to reuse the __setitem__ code?
The docstring for BaseMultiset.union says "For a variant of the operation which modifies the multiset in place see :meth:`union`.". But... that's what I'm looking at :-)
Your package metadata says you support both py2 and py3, but the wheel on pypi is marked as being py3-only. Maybe you need to set the universal=1 option in setup.cfg?
Not really a bug, but I found the semantics of remove and discard surprising: I would have expected them to be the inverse of add, rather than removing/discarding all copies by default. Maybe a less surprising design would be to have remove remove 1 item, discard discard 0 or 1 items, and then have remove_all and discard_all methods for when you want to do that? I don't know if it's worth breaking backwards compatibility over though.
The text was updated successfully, but these errors were encountered:
Thanks a lot for your feeback! I am happy that someone took the time to look through the code :-)
I fixed the issues you mentioned and will release a new version soon.
I am not sure about your last point. While I can see how this might be confusing, I do not want to make breaking changes to the API here. I don't think that the impact is that grave, especially since those methods can also be used to explicitly only remove/discard one element, e.g. with remove(1).
Multiset.__delitem__
is untested and appears to be broken: it doesn't updateself._total
. Maybe it should be implemented asself[element] = 0
to reuse the__setitem__
code?The docstring for
BaseMultiset.union
says "For a variant of the operation which modifies the multiset in place see :meth:`union`.". But... that's what I'm looking at :-)Your package metadata says you support both py2 and py3, but the wheel on pypi is marked as being py3-only. Maybe you need to set the universal=1 option in setup.cfg?
Not really a bug, but I found the semantics of
remove
anddiscard
surprising: I would have expected them to be the inverse ofadd
, rather than removing/discarding all copies by default. Maybe a less surprising design would be to haveremove
remove 1 item,discard
discard 0 or 1 items, and then haveremove_all
anddiscard_all
methods for when you want to do that? I don't know if it's worth breaking backwards compatibility over though.The text was updated successfully, but these errors were encountered: