We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6dac8d commit 4ca2751Copy full SHA for 4ca2751
README.md
@@ -635,9 +635,23 @@ class Employee(Person):
635
self.staff_num = staff_num
636
```
637
638
+### Comparable
639
+```python
640
+class MyComparable:
641
+ def __init__(self, a):
642
+ self.a = a
643
+ def __eq__(self, other):
644
+ # If not defined it returns id(self) == id(other).
645
+ if isinstance(other, MyComparable):
646
+ return self.a == other.a
647
+ return False
648
+ def __hash__(self):
649
+ return hash(self.a)
650
+```
651
+
652
### Sequence
653
```python
-class <name>:
654
+class MySequence:
655
def __init__(self, seq):
656
self.seq = seq
657
def __len__(self):
0 commit comments