Skip to Content
Practical Time Series Analysis
book

Practical Time Series Analysis

by PKS Prakash, Avishek Pal
September 2017
Beginner
244 pages
5h 20m
English
Packt Publishing
Content preview from Practical Time Series Analysis

Generators

Generators give the functionality of iterators but without having to write an entire class. In many cases, the logic of creating the elements of a sequence are implemented in the next function of an iterator. For example, the code to read a text file line by line and return the occurrence of a specific word in each line needs to be written in the next function of an iterator. Other functions such as __init__ and __iter__ are implemented in the class merely to suffice the requirements of developing an iterator.

Generators are special functions that simplify development. The yield keyword in a function signals the Python interpreter that the function is a generator. Using generator functions, we implement only the logic of creating ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Time Series Analysis

Practical Time Series Analysis

Aileen Nielsen

Publisher Resources

ISBN: 9781788290227Supplemental Content