Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3cc8a25

Browse files
committed
FAQ
1 parent 2a20695 commit 3cc8a25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

web/faq.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
<details open><summary><strong>What exactly is <code>&lt;collection&gt;</code>?</strong></summary><br>
2626
&nbsp;&nbsp;&nbsp;&nbsp;Collection is my name for an iterable object. An iterable object in Python is any object that has at least one of iter() and getitem() special methods defined. By convention, <code>&lt;object&gt;.__iter__()</code> should return an iterator of object's items and <code>&lt;object&gt;.__getitem__(&lt;index&gt;)</code> an item at that index. I chose not to use the name iterable because it sounds scarier and more vague than collection, even though it has a precise definition.<br><br>
27-
&nbsp;&nbsp;&nbsp;&nbsp;To make matters a bit more confusing, an abstract base class called Iterable doesn't fully follow this definition. An expression <code>instanceof(&lt;object&gt;, collections.abc.Iterable)</code> only checks whether an object has iter() special method, disregarding the getitem().<br><br>
28-
&nbsp;&nbsp;&nbsp;&nbsp;Although collection has no definition in Python's <a href="https://docs.python.org/3/glossary.html">glossary</a>, there exists a Collection abstract base class. Expression <code>instanceof(&lt;object&gt;, collections.abc.Collection)</code> returns 'True' for any object that has len() and at least one of iter() and getitem() special methods defined. By convention, <code>&lt;object&gt;.__len__()</code> should return the number of object's elements.
27+
&nbsp;&nbsp;&nbsp;&nbsp;To make matters a bit more confusing, an abstract base class called Iterable doesn't fully follow this definition. An expression <code>isinstance(&lt;object&gt;, collections.abc.Iterable)</code> only checks whether an object has iter() special method, disregarding the getitem().<br><br>
28+
&nbsp;&nbsp;&nbsp;&nbsp;Although collection has no definition in Python's <a href="https://docs.python.org/3/glossary.html">glossary</a>, there exists a Collection abstract base class. Expression <code>isinstance(&lt;object&gt;, collections.abc.Collection)</code> returns 'True' for any object that has len() and at least one of iter() and getitem() special methods defined. By convention, <code>&lt;object&gt;.__len__()</code> should return the number of object's elements.
2929
</details><br>
3030

3131
<details open><summary><strong>What about PEP 8?</strong></summary><br>

0 commit comments

Comments
 (0)