From 976668eca14327c1e204f63758b12e0b03861435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 30 Sep 2020 07:32:29 +0200 Subject: [PATCH] FAQ --- web/faq.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/faq.html b/web/faq.html index 151821f..7b0374a 100644 --- a/web/faq.html +++ b/web/faq.html @@ -3,7 +3,7 @@
What is the best way to use it?
-    I keep the text file open on separate desktop at all times. It is also in a different text editor than the one I usually use, so it's easier to switch to with Ctrl+↹ / ⌘↹. Cheatsheet consists of minimal text and short examples so things are easy to find with Ctrl+F / ⌘F.

+    I keep the text file open on separate desktop at all times. It is also in a different text editor than the one I usually use, so it's easier to switch to with Ctrl+↹ / ⌘↹. Cheatsheet consists of minimal text and short examples so things are easy to find with Ctrl+F / ⌘F. If you're on the webpage, searching for '#<name>' will only search for the titles.

    I also keep the Python console open at all times to test little snippets of code, to check out the available functions of a module using code completion and above all, to use help(<module/object/function/type>) command. If something is still unclear, then I search the Python docs by googling 'python docs <module/function>'.

@@ -23,9 +23,9 @@
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. <object>.__iter__() returns an iterator of object's items and <object>.__getitem__(<index>) returns 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.

- -    <iterable> should not be confused with abstract base class collections.abc.Iterable. Expression instanceof(<object>, collections.abc.Iterable) only checks if object has iter() special method. instanceof(<object>, collections.abc.Collection) checks for len(), iter() and contains(). +    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(), iter() and contains() special methods defined. <object>.__len__() should return the number of elements and <object>.__contains__(<el>) should check if object contains the passed element.

What about PEP 8?