how to build simple FSM using generators ?

Joh joh12005 at
Wed Sep 8 22:25:34 CEST 2004


i've readed "Charming Python: Generator-based state machines" linux/library/l-pygen.html , but i
still can not get the point on how using generator for FSM

i'm interested in a very simple FSM which would be able to recognize
consecutive sequence of texts, please can someone give me a hint on
how to do this using yield ?

by now, my fsm is something like, having a "previous state", iterating
in a while 1 loop, advancing "previous state" to recognized word and
if len(recognized all words) is matched then a sequence had been
recognized, whatever else re-init FSM ;
but can not understand how could yield help me...


More information about the Python-list mailing list