summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-02-09 00:08:16 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-02-09 00:08:16 (GMT)
commit71909423fd92862b869d8019d5e10c29bf946cb0 (patch)
treed9de4e086ee895337c3731f4a08d8d86337c0f11 /Lib/_abcoll.py
parentc1b6a4a1fd4de335426ffa3a8df2300aefed7a80 (diff)
downloadcpython-71909423fd92862b869d8019d5e10c29bf946cb0.zip
cpython-71909423fd92862b869d8019d5e10c29bf946cb0.tar.gz
cpython-71909423fd92862b869d8019d5e10c29bf946cb0.tar.bz2
Merge r60674 an 60675.
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 030bd7a..327b223 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -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:
+ try:
+ while True:
v = self[i]
- except IndexError:
- break
- yield v
- i += 1
+ yield v
+ i += 1
+ except IndexError:
+ return
def __contains__(self, value):
for v in self: