[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2020-05-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +19607 pull_request: https://github.com/python/cpython/pull/20339 ___ Python tracker ___

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-11 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22533 ___ ___

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: It is my thought that a Counter with all its keys set to zero is as empty as a Counter with no keys If the counter were a stand-alone multiset or bag class, this might be a reasonable thing to do. However, for better or for worse, the design of the

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-02 Thread Ethan Furman
Ethan Furman added the comment: Ignore that last comment -- I don't know what I did yesterday, but unary minus is working as expected today. :/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22533

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-01 Thread Ethan Furman
New submission from Ethan Furman: According to the docs [1]: Counter objects have a dictionary interface except that they return a zero count for missing items instead of raising a KeyError Which a simple test confirms: -- Counter()['b'] 0 However, if the key is present but set to zero,

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-01 Thread Josh Rosenberg
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

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-01 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22533 ___ ___ Python-bugs-list mailing list

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-01 Thread Ethan Furman
Ethan Furman added the comment: Exactly what operation is unary minus supposed to be? It seems to act like absolute value. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22533 ___