Re: state machine and a global variable

2007-12-16 Thread Michael Sparks
[EMAIL PROTECTED] wrote: > Basically, I agree that often the local state is much more useful. It > just seems to me that for some application it's an overkill. Like say, > for Turtle [1] (no jokes, please :) or PostScript [2]. Sounds also a bit similar to what happens under the hood in Open GL an

Re: state machine and a global variable

2007-12-15 Thread Steven D'Aprano
On Sat, 15 Dec 2007 01:07:17 -0800, tuom.larsen wrote: ... > later in the library I would like to expose the > simplified interface as well: > > _machine = StateMachine() > function0 = _machine.function0 > function1 = _machine.function1 > function2 = _machine.function2 > ... > > Is there a way t

Re: state machine and a global variable

2007-12-15 Thread tuom . larsen
On Dec 15, 1:50 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 14 Dec 2007 23:06:28 +0100, Bruno Desthuilliers wrote: > > Now the question is: why do you think it's so important for your users > > to only see functions ? What's so wrong with: > > > from state_machine im

Re: state machine and a global variable

2007-12-14 Thread Steven D'Aprano
On Fri, 14 Dec 2007 23:06:28 +0100, Bruno Desthuilliers wrote: > Now the question is: why do you think it's so important for your users > to only see functions ? What's so wrong with: > > from state_machine import * > m = get_state_machine() > m.set_state(42) I can't speak for the "only" part, b

Re: state machine and a global variable

2007-12-14 Thread tuom . larsen
On Dec 15, 12:02 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Dec 14, 2007 4:43 PM, <[EMAIL PROTECTED]> wrote: > > > > > On Dec 14, 11:06 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] a écrit : > > > > > Dear list, > > > > I'm writing very simple state machin

Re: state machine and a global variable

2007-12-14 Thread Chris Mellon
On Dec 14, 2007 4:43 PM, <[EMAIL PROTECTED]> wrote: > On Dec 14, 11:06 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] a écrit : > > > > > > Dear list, > > > I'm writing very simple state machine library, like this: > > > > > _state = None > > > > > def set_state(state):

Re: state machine and a global variable

2007-12-14 Thread tuom . larsen
On Dec 14, 11:06 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > > Dear list, > > I'm writing very simple state machine library, like this: > > > _state = None > > > def set_state(state): > > global _state > > _state = state > > > def get_state(): > >

Re: state machine and a global variable

2007-12-14 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Dear list, > I'm writing very simple state machine library, like this: > > > > _state = None > > def set_state(state): > global _state > _state = state > > def get_state(): > print _surface > NameError here !-) > > but I hate to use global variable

Re: state machine and a global variable

2007-12-14 Thread Carl Banks
On Dec 14, 11:52 am, [EMAIL PROTECTED] wrote: > Dear list, > I'm writing very simple state machine library, like this: > > _state = None > > def set_state(state): > global _state > _state = state > > def get_state(): > print _surface > > but I hate to use global variable. So, please, is

Re: state machine and a global variable

2007-12-14 Thread tuom . larsen
On Dec 14, 7:35 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Dec 14, 8:52 am, [EMAIL PROTECTED] wrote: > > > > > Dear list, > > I'm writing very simple state machine library, like this: > > > _state = None > > > def set_state(state): > > global _state > > _state = state > > > def get_state()

Re: state machine and a global variable

2007-12-14 Thread Matimus
On Dec 14, 8:52 am, [EMAIL PROTECTED] wrote: > Dear list, > I'm writing very simple state machine library, like this: > > _state = None > > def set_state(state): > global _state > _state = state > > def get_state(): > print _surface > > but I hate to use global variable. So, please, is

Re: state machine and a global variable

2007-12-14 Thread Chris Mellon
On Dec 14, 2007 10:52 AM, <[EMAIL PROTECTED]> wrote: > Dear list, > I'm writing very simple state machine library, like this: > > > > _state = None > > def set_state(state): > global _state > _state = state > > def get_state(): > print _surface > > > > but I hate to use global variable

state machine and a global variable

2007-12-14 Thread tuom . larsen
Dear list, I'm writing very simple state machine library, like this: _state = None def set_state(state): global _state _state = state def get_state(): print _surface but I hate to use global variable. So, please, is there a better way of doing this? All I want is that a user has