Juil 19, 2002
584 Vues
0 0

Charming Python: Generator-based state machines

Ecrit par

This article shows how to use Python’s new generators to simplify state machines and simulate coroutines. It also shows additional patterns for the use of generators, in hopes of bringing readers further into the mindset of « resumable functions. » If generators are new to you, you should first review the introduction to simple generators. There are a lot of benefits to using simple generators. In addition to offering more natural ways of expressing the flow of a class of problems, generators can dramatically improve many inefficiencies.


Laissez un commentaire

Menu Title