mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
Merge r60674 an 60675.
This commit is contained in:
parent
c1b6a4a1fd
commit
71909423fd
1 changed files with 19 additions and 6 deletions
|
|
@ -197,11 +197,24 @@ class Set(metaclass=ABCMeta):
|
|||
return NotImplemented
|
||||
return len(self) < len(other) and self.__le__(other)
|
||||
|
||||
def __gt__(self, other):
|
||||
if not isinstance(other, Set):
|
||||
return NotImplemented
|
||||
return other < self
|
||||
|
||||
def __ge__(self, other):
|
||||
if not isinstance(other, Set):
|
||||
return NotImplemented
|
||||
return other <= self
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, Set):
|
||||
return NotImplemented
|
||||
return len(self) == len(other) and self.__le__(other)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not (self == other)
|
||||
|
||||
@classmethod
|
||||
def _from_iterable(cls, it):
|
||||
'''Construct an instance of the class from any iterable input.
|
||||
|
|
@ -528,13 +541,13 @@ class Sequence(metaclass=ABCMeta):
|
|||
|
||||
def __iter__(self):
|
||||
i = 0
|
||||
while True:
|
||||
try:
|
||||
while True:
|
||||
v = self[i]
|
||||
except IndexError:
|
||||
break
|
||||
yield v
|
||||
i += 1
|
||||
except IndexError:
|
||||
return
|
||||
|
||||
def __contains__(self, value):
|
||||
for v in self:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue