Browse Source

Sequence

pull/10/head
Jure Šorn 5 years ago
parent
commit
b6999702b4
1 changed files with 5 additions and 5 deletions
  1. 10
      README.md

10
README.md

@ -652,14 +652,14 @@ class MyComparable:
### Sequence ### Sequence
```python ```python
class MySequence: class MySequence:
def __init__(self, seq):
self.seq = seq
def __init__(self, a):
self.a = a
def __len__(self): def __len__(self):
return len(self.seq)
return len(self.a)
def __getitem__(self, i): def __getitem__(self, i):
return self.seq[i]
return self.a[i]
def __iter__(self): def __iter__(self):
for el in self.seq:
for el in self.a:
yield el yield el
``` ```

Loading…
Cancel
Save