Josh Rosenberg added the comment:

Reading the note on the Counter class (about intent vs. actual use), it looks 
like changing this behavior would involve potentially breaking a lot of code.

If you're using Counters that are intended to maintain positive counts 
(treating a count <= 0 as if the key does not exist), it seems like you could 
either perform your operations using the + and - (or += and -=) binary 
operators (which will remove keys when the values drop to 0 or below) or if you 
have to use subtract or manual count tweaking, normalize the Counters at 
comparison time, that is, use +counter1 == +counter2 (unary + support added in 
3.3).

I agree it's sort of weird, but I feel like fixing it will just break a ton of 
existing code.

----------
nosy: +josh.rosenberg

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22533>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to