[Tutor] constants, flags or whatever

Jim Morcombe jmorcombe at westnet.com.au
Thu Dec 20 02:44:06 CET 2007


In a program, I want to set some kind of variable or object to indicate what "mode" the program is currently in.
What is the most elegant way of doing this?

Jim
---------------------------------------------------------------------------
constant: moving = "m"
constant: inserting = "i"
constant:jumping = "j"
.
.
action = moving
.
.
.
if action == jumping:
        jumpSomewhere()
elseif action == moving:
        moveSomewhere()
elseif action == inserting:
        insertSomething()
------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071220/50155295/attachment.htm 


More information about the Tutor mailing list