Dang, got away from me, anyway, like:

def switch(choice, functions = [cf0, cf1, cf2, cf3])
    if 0<choice<len(functions):
       return functions [ choice ]  # functions is a list of function objects
    else:
       print "Not valid"
       return

variations on that theme, i.e. not a big if, elif, elif, else -- just
use choice as an index into a list of functions.

Kirby


On 3/8/06, kirby urner <[EMAIL PROTECTED]> wrote:
> Cool, I'm in.  Checking out your moodle.
>
> Another way people write switch:
>
> def switch(choice):
>      if 0<choice<len(functions):
>
_______________________________________________
Edu-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to