[Python-checkins] cpython: Make the import private to keep the global namespace clean.

raymond.hettinger python-checkins at python.org
Mon Aug 4 07:41:06 CEST 2014


http://hg.python.org/cpython/rev/484e86c57298
changeset:   91982:484e86c57298
user:        Raymond Hettinger <python at rcn.com>
date:        Sun Aug 03 22:40:59 2014 -0700
summary:
  Make the import private to keep the global namespace clean.

files:
  Lib/difflib.py |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/difflib.py b/Lib/difflib.py
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -30,7 +30,7 @@
            'Differ','IS_CHARACTER_JUNK', 'IS_LINE_JUNK', 'context_diff',
            'unified_diff', 'HtmlDiff', 'Match']
 
-import heapq
+from heapq import nlargest as _nlargest
 from collections import namedtuple as _namedtuple
 
 Match = _namedtuple('Match', 'a b size')
@@ -729,7 +729,7 @@
             result.append((s.ratio(), x))
 
     # Move the best scorers to head of list
-    result = heapq.nlargest(n, result)
+    result = _nlargest(n, result)
     # Strip scores for the best n matches
     return [x for score, x in result]
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list