python generator of knowledge

Copyright: Shallow @ Copyright original article may not be reproduced without permission https://blog.csdn.net/xili2532/article/details/79945439

Generator need to add a general statement in the yield function, the generator is a special function that can be interrupted or restarted. yield return statement and similar statements, yield statement returns parameters back and pause at this location, next to continue in the same position. Builder is a special iterator is to achieve an iterator, connected to the text, it can be used to generate a column is further achieved for the Fibonacci numbers. Since the yield statement can be programmed to stop at any time, so do not worry about the program enters an infinite loop.
Generator is inferential brackets.


Guess you like

Origin blog.csdn.net/xili2532/article/details/79945439