summaryrefslogtreecommitdiffstats
path: root/Tools/unicode/makeunicodedata.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-01-27 18:17:45 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-01-27 18:17:45 (GMT)
commita56c467ac39ab1a6a2e9dc2fa41a9f573f989839 (patch)
treef65fc7d2a4359328f10c1dd9122a692e78e71e8a /Tools/unicode/makeunicodedata.py
parent191e850053128f726d6562e1d8306dfe5e4aa8aa (diff)
downloadcpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.zip
cpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.tar.gz
cpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.tar.bz2
Issue #1717: Remove cmp. Stage 1: remove all uses of cmp and __cmp__ from
the standard library and tests.
Diffstat (limited to 'Tools/unicode/makeunicodedata.py')
-rw-r--r--Tools/unicode/makeunicodedata.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py
index 0b32412..835e98b 100644
--- a/Tools/unicode/makeunicodedata.py
+++ b/Tools/unicode/makeunicodedata.py
@@ -457,15 +457,6 @@ def makeunicodetype(unicode, trace):
# --------------------------------------------------------------------
# unicode name database
-def CmpToKey(mycmp):
- 'Convert a cmp= function into a key= function'
- class K(object):
- def __init__(self, obj, *args):
- self.obj = obj
- def __lt__(self, other):
- return mycmp(self.obj, other.obj) == -1
- return K
-
def makeunicodename(unicode, trace):
FILE = "Modules/unicodename_db.h"
@@ -508,14 +499,10 @@ def makeunicodename(unicode, trace):
wordlist = list(words.items())
# sort on falling frequency, then by name
- def cmpwords(a,b):
+ def word_key(a):
aword, alist = a
- bword, blist = b
- r = -cmp(len(alist),len(blist))
- if r:
- return r
- return cmp(aword, bword)
- wordlist.sort(key=CmpToKey(cmpwords))
+ return -len(alist), aword
+ wordlist.sort(key=word_key)
# figure out how many phrasebook escapes we need
escapes = 0