Finite state machine in python

Tim Chase python.list at tim.thechases.com
Sat Sep 12 21:55:13 EDT 2009


> I have see some discussion on the implementation of finite
> state machine in python. Can somebody point to me the best way
> in implenting an FSM in python?

To offer a "best way" requires knowing more about what you're 
trying to accomplish.  Are you looking for just some fixed 
states?  are you looking to dynamically adjust the available 
states?  Is this workflow for a single user, or is it for 
multiple users?  A FSM merely involves a list of states and the 
transitions between them.  You can augment the states and/or the 
transitions with additional metadata.  You can store your states 
in fixed internal hard-coded structures, or you can store them in 
a file/database that can grow external.

I posted information on doing this with a SQL-ish database 
(whether sqlite or whatever) a while back, so you can see a more 
"complex" version of tracking this info:

http://article.gmane.org/gmane.comp.python.general/624448


Hope this gives you some ideas from which to choose an option 
that's "best" for your needs.

-tkc








More information about the Python-list mailing list