From ee3fd66e7048c56325a951893cab20dd78e0b9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 27 Jun 2019 20:03:11 +0200 Subject: [PATCH] MyCollection --- README.md | 7 +++++++ index.html | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index e1cd5d6..ef227d3 100644 --- a/README.md +++ b/README.md @@ -1046,6 +1046,13 @@ class MyCollection: yield el ``` +```python +>>> from collections.abc import Sequence, Collection, Iterable +>>> a = MyCollection([1, 2, 3]) +>>> isinstance(a, Sequence), isinstance(a, Collection), isinstance(a, Iterable) +(False, True, True) +``` + ### Iterator ```python class Counter: diff --git a/index.html b/index.html index bc6664b..5ba62ac 100644 --- a/index.html +++ b/index.html @@ -981,6 +981,11 @@ creature = Creature(Point(0, for el in self.a: yield el +
>>> from collections.abc import Sequence, Collection, Iterable
+>>> a = MyCollection([1, 2, 3])
+>>> isinstance(a, Sequence), isinstance(a, Collection), isinstance(a, Iterable)
+(False, True, True)
+

Iterator

class Counter:
     def __init__(self):