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 serhiy.storchaka
Recipients berker.peksag, bethard, paul.j3, rhettinger, serhiy.storchaka, vstinner, wolma, yan12125
Date 2017-04-26.09:01:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493197279.46.0.803226043646.issue30152@psf.upfronthosting.co.za>
In-reply-to
Content
collections is very popular module. It is almost impossible to avoid importing it since so much stdlib modules use namedtuple, OrderedDict, deque, or defaultdict. The reason of moving a heapq import inside a Counter method is that importing heapq adds two entries in sys.modules ('heapq' and '_heapq'), but it is needed only when Counter.most_common() is called with non-default argument. The Counter class is less used than other four popular collections classes, not every use of the Counter class involves using of the most_common() method, and the most_common() method not always is called with argument (actually it is used only twice in the stdlib, in both cases without argument).

I'll remove this change if you say this, but this will decrease the effect of this patch from 10 to 8 modules.
History
Date User Action Args
2017-04-26 09:01:19serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, bethard, vstinner, berker.peksag, paul.j3, wolma, yan12125
2017-04-26 09:01:19serhiy.storchakasetmessageid: <1493197279.46.0.803226043646.issue30152@psf.upfronthosting.co.za>
2017-04-26 09:01:19serhiy.storchakalinkissue30152 messages
2017-04-26 09:01:19serhiy.storchakacreate