[New-bugs-announce] [issue46019] collections.Counter - Cast list of keys into set to remove iteration over duplicate elements for __le__, __ge__ and __eq__

Rahul Gupta report at bugs.python.org
Wed Dec 8 20:52:20 EST 2021


New submission from Rahul Gupta <rg119 at ic.ac.uk>:

On lines 725, 737 and 749 there is the following code:

'''for c in (self, other) for e in c''' which generates an iterable with all the keys in self and other - casting c to a set will remove duplicates and allow faster iteration - some minor benchmarks I ran seem to agree.

----------
components: Library (Lib)
messages: 408063
nosy: argoop1728
priority: normal
severity: normal
status: open
title: collections.Counter - Cast list of keys into set to remove iteration over duplicate elements for __le__,__ge__ and __eq__
type: performance
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46019>
_______________________________________


More information about the New-bugs-announce mailing list