Re: Coding a simple state machine in python

2014-03-02 Thread alex23
On 25/02/2014 8:01 PM, Peter Otten wrote: alex23 wrote: No, the _easy_ solution is [find a suitable package on PyPI] Easy? By the time I have evaluated these I've written my own ;) It's never writing a solution that's the problem...it's maintaining it over time :) -- https://mail.python.o

Re: Coding a simple state machine in python

2014-03-01 Thread Roy Smith
In article <65ac9612-fd48-472a-b077-c802be96e...@googlegroups.com>, Ronaldo wrote: > How do I write a state machine in python? I have identified the states and > the conditions. Is it possible to do simple a if-then-else sort of an > algorithm? Below is some pseudo code: > > if state == "ABC"

Re: Coding a simple state machine in python

2014-02-25 Thread Marko Rauhamaa
Peter Otten <__pete...@web.de>: > Why have the function return a name? Why not just another function? As people have said, there are many ways to skin the cat. A function can represent a state if it is the only type of event the state machine must process. A regular expression parser would be an

Re: Coding a simple state machine in python

2014-02-25 Thread Peter Otten
William Ray Wing wrote: > > On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: > >> How do I write a state machine in python? I have identified the states >> and the conditions. Is it possible to do simple a if-then-else sort of an >> algorithm? Below is some pseudo code: >> >> if state == "ABC": >>

Re: Coding a simple state machine in python

2014-02-25 Thread Peter Otten
alex23 wrote: > On 25/02/2014 1:27 PM, Tim Daneliuk wrote: >> On 02/24/2014 08:55 PM, William Ray Wing wrote: >>> On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? > >> >>> Stackoverflow has a couple of compact examples here: >> >> Now you're making it TO

Re: Coding a simple state machine in python

2014-02-25 Thread Mark Lawrence
On 25/02/2014 05:19, alex23 wrote: On 25/02/2014 1:27 PM, Tim Daneliuk wrote: On 02/24/2014 08:55 PM, William Ray Wing wrote: On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? >> Stackoverflow has a couple of compact examples here: Now you're making it

Re: Coding a simple state machine in python

2014-02-24 Thread alex23
On 25/02/2014 1:27 PM, Tim Daneliuk wrote: On 02/24/2014 08:55 PM, William Ray Wing wrote: On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? >> Stackoverflow has a couple of compact examples here: Now you're making it TOO easy Bill ;) No, the _easy_ so

Re: Coding a simple state machine in python

2014-02-24 Thread Tim Daneliuk
On 02/24/2014 08:55 PM, William Ray Wing wrote: On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? I have identified the states and the conditions. Is it possible to do simple a if-then-else sort of an algorithm? Below is some pseudo code: if state == "AB

Re: Coding a simple state machine in python

2014-02-24 Thread William Ray Wing
On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: > How do I write a state machine in python? I have identified the states and > the conditions. Is it possible to do simple a if-then-else sort of an > algorithm? Below is some pseudo code: > > if state == "ABC": > do_something() > change state t

Re: Coding a simple state machine in python

2014-02-24 Thread Tim Daneliuk
On 02/24/2014 07:30 PM, Ronaldo wrote: How do I write a state machine in python? I have identified the states and the conditions. Is it possible to do simple a if-then-else sort of an algorithm? Below is some pseudo code: if state == "ABC": do_something() change state to DEF if state

Coding a simple state machine in python

2014-02-24 Thread Ronaldo
How do I write a state machine in python? I have identified the states and the conditions. Is it possible to do simple a if-then-else sort of an algorithm? Below is some pseudo code: if state == "ABC": do_something() change state to DEF if state == "DEF" perform_the_next_function() ...