Skip to content

Commit dc57108

Browse files
committed
Collection instead of Sequence
1 parent e5ea8a9 commit dc57108

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,11 +887,11 @@ class MyHashable:
887887
return hash(self.a)
888888
```
889889

890-
### Sequence
890+
### Collection
891891
* **Methods do not depend on each other, so they can be skipped if not needed.**
892892
* **Any object with defined getitem() is considered iterable, even if it lacks iter().**
893893
```python
894-
class MySequence:
894+
class MyCollection:
895895
def __init__(self, a):
896896
self.a = a
897897
def __len__(self):
@@ -900,6 +900,8 @@ class MySequence:
900900
return self.a[i]
901901
def __setitem__(self, i, value):
902902
self.a[i] = value
903+
def __contains__(self, value):
904+
return value in self.a
903905
def __iter__(self):
904906
for el in self.a:
905907
yield el

0 commit comments

Comments
 (0)