[Tutor] Looking for suggestions

R. Alan Monroe amonroe at columbus.rr.com
Mon Nov 14 12:50:09 CET 2005


> To anyone willing to take the time to have a
> look at the code and offer any advice or
> suggestions, I would be much appreciative.

I'm wondering if you can condense this:

    if sel1 == 1 and sel2 == 4:         # This seems really ugly...
        if state[1] == 1:
            return 2
    elif sel1 == 1 and sel2 == 6:
        if state[2] == 1:
            return 3


Into this:

sel={(1,4): (1,3),
     (1,6): (2,2),
etc.}

if state[ sel[(sel1,sel2)][0] ] == 1:
   return sel[(sel1,sel2)][1]


Alan



More information about the Tutor mailing list