mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Patch #424475: Speed-up tp_compare usage, by special-casing the common
case of objects with equal types which support tp_compare. Give type objects a tp_compare function. Also add c<0 tests before a few PyErr_Occurred tests.
This commit is contained in:
parent
7bc50714fe
commit
0163d6d6ef
3 changed files with 62 additions and 23 deletions
|
@ -22,7 +22,7 @@ class UserList:
|
|||
if isinstance(other, UserList): return other.data
|
||||
else: return other
|
||||
def __cmp__(self, other):
|
||||
raise RuntimeError, "UserList.__cmp__() is obsolete"
|
||||
return cmp(self.data, self.__cast(other))
|
||||
def __contains__(self, item): return item in self.data
|
||||
def __len__(self): return len(self.data)
|
||||
def __getitem__(self, i): return self.data[i]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue