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 rhettinger
Recipients HuangFuSL, rhettinger
Date 2021-01-29.19:13:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611947599.82.0.896978720222.issue43062@roundup.psfhosted.org>
In-reply-to
Content
Thanks for the report, but there isn't anything that can be done about this.  The core design concept for Counter was to be a regular dictionary augmented by a few capabilities that made it suitable for counting.  It isn't closed-off in any way.  On the plus side, that makes it versatile and make it fit well the other parts of the Python ecosystem that work with dictionaries.  On the minus, there is nothing to keep out data that doesn't make sense in the context of counting.

FWIW, there is a multiset package on PyPi that offers a closed-off implementation that has an internal dictionary that can only be accessed by methods that prevent negative counts or non-integer values.
History
Date User Action Args
2021-01-29 19:13:19rhettingersetrecipients: + rhettinger, HuangFuSL
2021-01-29 19:13:19rhettingersetmessageid: <1611947599.82.0.896978720222.issue43062@roundup.psfhosted.org>
2021-01-29 19:13:19rhettingerlinkissue43062 messages
2021-01-29 19:13:19rhettingercreate