[Python-checkins] cpython (2.7): Issue #11628: cmp_to_key should use__slots__.

raymond.hettinger python-checkins at python.org
Tue Mar 22 21:21:07 CET 2011


http://hg.python.org/cpython/rev/136298326897
changeset:   68835:136298326897
branch:      2.7
parent:      68827:a56cd7aeac5e
user:        Raymond Hettinger <python at rcn.com>
date:        Tue Mar 22 13:20:59 2011 -0700
summary:
  Issue #11628: cmp_to_key should use__slots__.

files:
  Lib/functools.py

diff --git a/Lib/functools.py b/Lib/functools.py
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -80,6 +80,7 @@
 def cmp_to_key(mycmp):
     """Convert a cmp= function into a key= function"""
     class K(object):
+        __slots__ = ['obj']
         def __init__(self, obj, *args):
             self.obj = obj
         def __lt__(self, other):

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


More information about the Python-checkins mailing list