From 137a171238c64187f600e464f4df8af46a2ae9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 7 Jul 2019 17:41:16 +0200 Subject: [PATCH] Iterable duck types --- README.md | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a5fc558..8a96197 100644 --- a/README.md +++ b/README.md @@ -1231,7 +1231,7 @@ class MySequence: ### Collections.abc.Sequence * **It's a richer interface than the basic sequence.** * **Extending it generates iter(), contains(), reversed(), index(), and count().** -* **Unlike `'abc.Iterable'` and `'abc.Collection'`, it is not a duck type. That's why `'issubclass(MySequence, collections.abc.Sequence)'` would return 'False' even if it had all the methods defined.** +* **Unlike `'abc.Iterable'` and `'abc.Collection'`, it is not a duck type. That is why `'issubclass(MySequence, collections.abc.Sequence)'` would return 'False' even if it had all the methods defined.** ```python class MyAbcSequence(collections.abc.Sequence): def __init__(self, a): diff --git a/index.html b/index.html index 3546e72..60061f4 100644 --- a/index.html +++ b/index.html @@ -1144,7 +1144,7 @@ con = sqlite3.connect('<path>');
  • It's a richer interface than the basic sequence.
  • Extending it generates iter(), contains(), reversed(), index(), and count().
  • -
  • Unlike 'abc.Iterable' and 'abc.Collection', it is not a duck type. That's why 'issubclass(MySequence, collections.abc.Sequence)' would return 'False' even if it had all the methods defined.
  • +
  • Unlike 'abc.Iterable' and 'abc.Collection', it is not a duck type. That is why 'issubclass(MySequence, collections.abc.Sequence)' would return 'False' even if it had all the methods defined.
  • class MyAbcSequence(collections.abc.Sequence):
         def __init__(self, a):