Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bfb0788 commit dffb909Copy full SHA for dffb909
1 file changed
Lib/collections/__init__.py
@@ -59,6 +59,8 @@
59
except ImportError:
60
pass
61
62
+heapq = None # Lazily imported
63
+
64
65
################################################################################
66
### OrderedDict
@@ -633,7 +635,10 @@ def most_common(self, n=None):
633
635
return sorted(self.items(), key=_itemgetter(1), reverse=True)
634
636
637
# Lazy import to speedup Python startup time
- import heapq
638
+ global heapq
639
+ if heapq is None:
640
+ import heapq
641
642
return heapq.nlargest(n, self.items(), key=_itemgetter(1))
643
644
def elements(self):
0 commit comments