mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #11628: cmp_to_key should use__slots__.
This commit is contained in:
parent
7250730afc
commit
911da47996
1 changed files with 1 additions and 0 deletions
|
@ -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):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue