From 3cc8a252019a5fb23ae8fcfd827da9350c601cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 30 Sep 2020 07:45:11 +0200 Subject: [PATCH] FAQ --- web/faq.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/faq.html b/web/faq.html index c7633d9..330bea0 100644 --- a/web/faq.html +++ b/web/faq.html @@ -24,8 +24,8 @@
What exactly is <collection>?
    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, <object>.__iter__() should return an iterator of object's items and <object>.__getitem__(<index>) 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.

-    To make matters a bit more confusing, an abstract base class called Iterable doesn't fully follow this definition. An expression instanceof(<object>, collections.abc.Iterable) only checks whether an object has iter() special method, disregarding the getitem().

-    Although collection has no definition in Python's glossary, there exists a Collection abstract base class. Expression instanceof(<object>, collections.abc.Collection) returns 'True' for any object that has len() and at least one of iter() and getitem() special methods defined. By convention, <object>.__len__() should return the number of object's elements. +    To make matters a bit more confusing, an abstract base class called Iterable doesn't fully follow this definition. An expression isinstance(<object>, collections.abc.Iterable) only checks whether an object has iter() special method, disregarding the getitem().

+    Although collection has no definition in Python's glossary, there exists a Collection abstract base class. Expression isinstance(<object>, collections.abc.Collection) returns 'True' for any object that has len() and at least one of iter() and getitem() special methods defined. By convention, <object>.__len__() should return the number of object's elements.

What about PEP 8?