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 e5ea8a9 commit dc57108Copy full SHA for dc57108
README.md
@@ -887,11 +887,11 @@ class MyHashable:
887
return hash(self.a)
888
```
889
890
-### Sequence
+### Collection
891
* **Methods do not depend on each other, so they can be skipped if not needed.**
892
* **Any object with defined getitem() is considered iterable, even if it lacks iter().**
893
```python
894
-class MySequence:
+class MyCollection:
895
def __init__(self, a):
896
self.a = a
897
def __len__(self):
@@ -900,6 +900,8 @@ class MySequence:
900
return self.a[i]
901
def __setitem__(self, i, value):
902
self.a[i] = value
903
+ def __contains__(self, value):
904
+ return value in self.a
905
def __iter__(self):
906
for el in self.a:
907
yield el
0 commit comments