From b9b503a23c0753fb94c608cd1b70364e3c4c2511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 4 Jul 2019 18:36:05 +0200 Subject: [PATCH] Duck types --- README.md | 4 ++-- index.html | 4 ++-- parse.js | 4 ++-- web/script_2.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3a1f13d..020bab5 100644 --- a/README.md +++ b/README.md @@ -1138,10 +1138,10 @@ class MyAbcSequence(collections.abc.Sequence): return self.a[i] ``` -#### Table of provided methods: +#### Table of the methods that each (duck) type provides: ```text +------------+----------+------------+----------+--------------+ -| | iterable | collection | sequence | abc.Sequence | +| | Iterable | Collection | Sequence | abc.Sequence | +------------+----------+------------+----------+--------------+ | iter() | yes | yes | yes | yes | | len() | | yes | yes | yes | diff --git a/index.html b/index.html index 1f00f4b..8f19505 100644 --- a/index.html +++ b/index.html @@ -1070,9 +1070,9 @@ Z = dataclasses.make_dataclass('Z', [def __getitem__(self, i): return self.a[i] -

Table of provided methods:

+

Table of the methods that each (duck) type provides:

┏━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━┓
-┃            │ iterable │ collection │ sequence │ abc.Sequence ┃
+┃            │ Iterable │ Collection │ Sequence │ abc.Sequence ┃
 ┠────────────┼──────────┼────────────┼──────────┼──────────────┨
 ┃ iter()     │    ✓     │     ✓      │    ✓     │      ✓       ┃
 ┃ len()      │          │     ✓      │    ✓     │      ✓       ┃
diff --git a/parse.js b/parse.js
index e0ba51f..ffc7cb5 100755
--- a/parse.js
+++ b/parse.js
@@ -142,7 +142,7 @@ const DIAGRAM_5_B =
 
 const DIAGRAM_6_A =
   '+------------+----------+------------+----------+--------------+\n' +
-  '|            | iterable | collection | sequence | abc.Sequence |\n' +
+  '|            | Iterable | Collection | Sequence | abc.Sequence |\n' +
   '+------------+----------+------------+----------+--------------+\n' +
   '| iter()     |   yes    |    yes     |   yes    |     yes      |\n' +
   '| len()      |          |    yes     |   yes    |     yes      |\n' +
@@ -152,7 +152,7 @@ const DIAGRAM_6_A =
 
 const DIAGRAM_6_B =
   '┏━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━┓\n' +
-  '┃            │ iterable │ collection │ sequence │ abc.Sequence ┃\n' +
+  '┃            │ Iterable │ Collection │ Sequence │ abc.Sequence ┃\n' +
   '┠────────────┼──────────┼────────────┼──────────┼──────────────┨\n' +
   '┃ iter()     │    ✓     │     ✓      │    ✓     │      ✓       ┃\n' +
   '┃ len()      │          │     ✓      │    ✓     │      ✓       ┃\n' +
diff --git a/web/script_2.js b/web/script_2.js
index 22cdc65..c12755e 100644
--- a/web/script_2.js
+++ b/web/script_2.js
@@ -110,7 +110,7 @@ const DIAGRAM_5_B =
 
 const DIAGRAM_6_A =
   '+------------+----------+------------+----------+--------------+\n' +
-  '|            | iterable | collection | sequence | abc.Sequence |\n' +
+  '|            | Iterable | Collection | Sequence | abc.Sequence |\n' +
   '+------------+----------+------------+----------+--------------+\n' +
   '| iter()     |   yes    |    yes     |   yes    |     yes      |\n' +
   '| len()      |          |    yes     |   yes    |     yes      |\n' +
@@ -120,7 +120,7 @@ const DIAGRAM_6_A =
 
 const DIAGRAM_6_B =
   '┏━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━┓\n' +
-  '┃            │ iterable │ collection │ sequence │ abc.Sequence ┃\n' +
+  '┃            │ Iterable │ Collection │ Sequence │ abc.Sequence ┃\n' +
   '┠────────────┼──────────┼────────────┼──────────┼──────────────┨\n' +
   '┃ iter()     │    ✓     │     ✓      │    ✓     │      ✓       ┃\n' +
   '┃ len()      │          │     ✓      │    ✓     │      ✓       ┃\n' +