ch17: update from book draft

This commit is contained in:
Luciano Ramalho
2020-02-18 23:45:05 -03:00
parent 70650841b3
commit aa868e8f75
35 changed files with 788 additions and 31 deletions

View File

@@ -19,7 +19,7 @@ Arithmetic progression generator function::
"""
# BEGIN ARITPROG_GENFUNC
# tag::ARITPROG_GENFUNC[]
def aritprog_gen(begin, step, end=None):
result = type(begin + step)(begin)
forever = end is None
@@ -28,4 +28,4 @@ def aritprog_gen(begin, step, end=None):
yield result
index += 1
result = begin + step * index
# END ARITPROG_GENFUNC
# end::ARITPROG_GENFUNC[]