[issue46019] collections.Counter - Cast list of keys into set to remove iteration over duplicate elements for __le__, __ge__ and __eq__
Rahul Gupta added the comment: After looking at this again, I agree with you - the key duplication issue seems to have gone. Thank you for providing this feedback, it is very helpful. -- ___ Python tracker <https://bugs.python.org/issue46019> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46019] collections.Counter - Cast list of keys into set to remove iteration over duplicate elements for __le__, __ge__ and __eq__
Change by Rahul Gupta : -- keywords: +patch pull_requests: +28222 stage: -> patch review pull_request: https://github.com/python/cpython/pull/2 ___ Python tracker <https://bugs.python.org/issue46019> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46019] collections.Counter - Cast list of keys into set to remove iteration over duplicate elements for __le__, __ge__ and __eq__
New submission from Rahul Gupta : 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 <https://bugs.python.org/issue46019> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23275] Can assign [] = (), but not () = []
Rahul Gupta added the comment: isn't it logical? [] is a mutable data structure while () is a immutable data structure (b, a) = [1, 2] is fine because a and b are mutable -- nosy: +Rahul Gupta ___ Python tracker <http://bugs.python.org/issue23275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com