state machine and a global variable
tuom.larsen at gmail.com
tuom.larsen at gmail.com
Fri Dec 14 11:52:20 EST 2007
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 to type as little as
possible, like:
from state_machine import *
set_state(3)
get_state()
I.e., nothing like:
import state_machine
my_machine = state_machine.new_machine()
my_machine.set_state(3)
my_machine.get_state()
Thanks, in advance!
More information about the Python-list
mailing list