From e3472c21038d33c5d267c0c4c6ea375ab7679bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 4 Jul 2019 03:39:17 +0200 Subject: [PATCH] Generator --- README.md | 4 +++- index.html | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 18e8a38..dc6216b 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,9 @@ from itertools import count, repeat, cycle, chain, islice Generator --------- -**Convenient way to implement the iterator protocol.** +* **Convenient way to implement the iterator protocol.** +* **Any function that contains a yield statement returns a generator object.** +* **Generators and iterators are interchangeable.** ```python def count(start, step): diff --git a/index.html b/index.html index 0fc2f79..c1aa7ca 100644 --- a/index.html +++ b/index.html @@ -346,7 +346,11 @@ to_exclusive = <range>.stop <iter> = islice(<collection>, from_inclusive, to_exclusive, +step_size)

#Generator

-

Convenient way to implement the iterator protocol.

+
def count(start, step):
     while True:
         yield start