This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients ethan.furman, josh.r
Date 2014-10-01.22:05:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412201151.1.0.430825908657.issue22533@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-10-01 22:05:51josh.rsetrecipients: + josh.r, ethan.furman
2014-10-01 22:05:51josh.rsetmessageid: <1412201151.1.0.430825908657.issue22533@psf.upfronthosting.co.za>
2014-10-01 22:05:51josh.rlinkissue22533 messages
2014-10-01 22:05:50josh.rcreate