State Machines in Python

Jack Keegan whatsjacksemail at
Sat Sep 4 15:36:38 CEST 2010

Hi girls & guys,

Just joined the group. I'm new to Python but been picking it up pretty easy.
I love it! I'm hoping to use it to make a controlling application for an
experiment. Basically I want to use it to interface with some data
acquisition (DAQ) hardware to accept incoming signals and respond sending
signals to the outputs. I'm looking for an efficient State Machine algorithm
as I need the timing to be as good as possible.
As there is no switch statement in Python, I've been looking around for a
good implementation. Most of the algorithms I've come across seem to be
based on parsing applications. I'd like something more suited to my needs.
I'd like to avoid excessive use of 'if-elif-else' statements as each would
have to be checked to find the right conditions which would have an time
overhead involved. I have seen an implementation of the switch using
dictionaries but someone had commented that creating and throwing away
dictionaries also comes at a cost.
I was wondering if any of you could advise or point me in the right

Any help would be greatly appreciated.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list