Re: State Machines in Python

2010-09-04 Thread Roy Smith
In article , "D'Arcy J.M. Cain" wrote: > On Sat, 04 Sep 2010 13:58:00 -0400 > Roy Smith wrote: > > > while True: > > > state = state(data) > > > > This is the pattern I've always used. Simple and effective for any > > state machine which is small enough to code by hand. I generally have

Re: State Machines in Python

2010-09-04 Thread Stefan Behnel
D'Arcy J.M. Cain, 04.09.2010 20:30: On Sat, 04 Sep 2010 13:58:00 -0400 Roy Smith wrote: while True: state = state(data) This is the pattern I've always used. Simple and effective for any state machine which is small enough to code by hand. I generally have my state methods return (next

Re: State Machines in Python

2010-09-04 Thread D'Arcy J.M. Cain
On Sat, 04 Sep 2010 19:13:28 +0100 MRAB wrote: > I suppose that if they are that similar then you could generate the > code from a list or table of the states. They generally aren't as simple as the little example script that I cobbled together. -- D'Arcy J.M. Cain | Democracy is thre

Re: State Machines in Python

2010-09-04 Thread D'Arcy J.M. Cain
On Sat, 04 Sep 2010 13:58:00 -0400 Roy Smith wrote: > > while True: > > state = state(data) > > This is the pattern I've always used. Simple and effective for any > state machine which is small enough to code by hand. I generally have > my state methods return (next_state, output) tuples,

Re: State Machines in Python

2010-09-04 Thread MRAB
On 04/09/2010 18:58, Roy Smith wrote: In article, "D'Arcy J.M. Cain" wrote: On Sat, 4 Sep 2010 14:36:38 +0100 Jack Keegan wrote: Just joined the group. I'm new to Python but been picking it up pretty easy. Welcome aboard. As there is no switch statement in Python, I've been looking aro

Re: State Machines in Python

2010-09-04 Thread Roy Smith
In article , "D'Arcy J.M. Cain" wrote: > On Sat, 4 Sep 2010 14:36:38 +0100 > Jack Keegan wrote: > > Just joined the group. I'm new to Python but been picking it up pretty easy. > > Welcome aboard. > > > As there is no switch statement in Python, I've been looking around for a > > good impleme

Re: State Machines in Python

2010-09-04 Thread Stef Mientki
On 04-09-2010 15:36, Jack Keegan wrote: > 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 acquisit

Re: State Machines in Python

2010-09-04 Thread Stefan Behnel
Jack Keegan, 04.09.2010 15:36: Hi girls& guys, Just joined the group. I'm new to Python but been picking it up pretty easy. I love it! Welcome to the group. 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 acqu

Re: State Machines in Python

2010-09-04 Thread D'Arcy J.M. Cain
On Sat, 4 Sep 2010 14:36:38 +0100 Jack Keegan wrote: > Just joined the group. I'm new to Python but been picking it up pretty easy. Welcome aboard. > 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 b

State Machines in Python

2010-09-04 Thread Jack Keegan
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 respon