上QQ阅读APP看书,第一时间看更新
Asynchronous handlers with generators
The previous code works perfectly, but as it expands it becomes more and more difficult to maintain. The main reason is that the code flow is spread across multiple locations. Generators can solve this issue by writing asynchronous code that looks like synchronous code. Before rewriting the previous code with a generator, let's look at generators.