Browse Source

Iterable duck types

pull/40/head
Jure Šorn 5 years ago
parent
commit
63fc68def1
2 changed files with 4 additions and 2 deletions
  1. 3
      README.md
  2. 3
      index.html

3
README.md

@ -1215,7 +1215,8 @@ class MyCollection:
```
### Sequence
* **Only required methods are len() and getitem(), that should return an item at index or raise 'IndexError'.**
* **Only required methods are len() and getitem().**
* **Getitem() should return an item at index or raise 'IndexError'.**
* **Iter() and contains() automatically work on any object that has getitem() defined.**
* **Reversed() automatically works on any object that has getitem() and len() defined.**
```python

3
index.html

@ -1130,7 +1130,8 @@ lock = threading.RLock(); <span class="hljs-keyword">with</span> lock: ...
</code></pre>
<h3 id="sequence">Sequence</h3>
<ul>
<li><strong>Only required methods are len() and getitem(), that should return an item at index or raise 'IndexError'.</strong></li>
<li><strong>Only required methods are len() and getitem().</strong></li>
<li><strong>Getitem() should return an item at index or raise 'IndexError'.</strong></li>
<li><strong>Iter() and contains() automatically work on any object that has getitem() defined.</strong></li>
<li><strong>Reversed() automatically works on any object that has getitem() and len() defined.</strong></li>
</ul>

Loading…
Cancel
Save