]> granicus.if.org Git - python/commitdiff
Issue #11628: cmp_to_key should use__slots__.
authorRaymond Hettinger <python@rcn.com>
Tue, 22 Mar 2011 20:20:59 +0000 (13:20 -0700)
committerRaymond Hettinger <python@rcn.com>
Tue, 22 Mar 2011 20:20:59 +0000 (13:20 -0700)
Lib/functools.py

index 01889cb0c3c79c0d96653aff416ee3caa59f9f1d..53680b894660774d5c460c0198221d9444d23923 100644 (file)
@@ -80,6 +80,7 @@ def total_ordering(cls):
 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):