what's different about loop data with yield and without yield

This question already has an answer here:

  • What does the “yield” keyword do? 36 answers

  • Functionally, they're the same.

    The main difference is that, in the second case, it's really easy to have several different "do something" blocks without repeating the SQL statement. In the first case, the "do something" is hard-coded.

    链接地址: http://www.djcxy.com/p/1558.html

    上一篇: 关于Python中的生成器

    下一篇: 循环数据的收益率和收益率有什么不同