@@ -302,6 +302,41 @@ def insert(self, index, item):
302
302
if conversion_func else item
303
303
)
304
304
305
+ def __le__ (self , other ): # Taken from collections.abc.Set
306
+ if not isinstance (other , collections .abc .Sequence ):
307
+ return NotImplemented
308
+ if len (self ) > len (other ):
309
+ return False
310
+ for elem in self :
311
+ if elem not in other :
312
+ return False
313
+ return True
314
+
315
+ def __lt__ (self , other ): # Taken from collections.abc.Set
316
+ if not isinstance (other , collections .abc .Sequence ):
317
+ return NotImplemented
318
+ return len (self ) < len (other ) and self .__le__ (other )
319
+
320
+ def __gt__ (self , other ): # Taken from collections.abc.Set
321
+ if not isinstance (other , collections .abc .Sequence ):
322
+ return NotImplemented
323
+ return len (self ) > len (other ) and self .__ge__ (other )
324
+
325
+ def __ge__ (self , other ): # Taken from collections.abc.Set
326
+ if not isinstance (other , collections .abc .Sequence ):
327
+ return NotImplemented
328
+ if len (self ) < len (other ):
329
+ return False
330
+ for elem in other :
331
+ if elem not in self :
332
+ return False
333
+ return True
334
+
335
+ def __eq__ (self , other ): # Taken from collections.abc.Set
336
+ if not isinstance (other , collections .abc .Sequence ):
337
+ return NotImplemented
338
+ return len (self ) == len (other ) and self .__le__ (other )
339
+
305
340
collections .abc .MutableSequence .register (sequenceClass )
306
341
sequenceClass .__radd__ = __radd__
307
342
sequenceClass .__add__ = __add__
@@ -311,6 +346,11 @@ def insert(self, index, item):
311
346
sequenceClass .insert = insert
312
347
sequenceClass .__str__ = __str__
313
348
sequenceClass .__repr__ = __repr__
349
+ sequenceClass .__le__ = __le__
350
+ sequenceClass .__lt__ = __lt__
351
+ sequenceClass .__gt__ = __gt__
352
+ sequenceClass .__ge__ = __ge__
353
+ sequenceClass .__eq__ = __eq__
314
354
315
355
seen = set ()
316
356
for klass in (collections .abc .MutableSequence , collections .abc .Sequence ):
0 commit comments