Kaydet (Commit) 911da479 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Issue #11628: cmp_to_key should use__slots__.

üst 7250730a
...@@ -80,6 +80,7 @@ def total_ordering(cls): ...@@ -80,6 +80,7 @@ def total_ordering(cls):
def cmp_to_key(mycmp): def cmp_to_key(mycmp):
"""Convert a cmp= function into a key= function""" """Convert a cmp= function into a key= function"""
class K(object): class K(object):
__slots__ = ['obj']
def __init__(self, obj, *args): def __init__(self, obj, *args):
self.obj = obj self.obj = obj
def __lt__(self, other): def __lt__(self, other):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment