Any simpler way to do this

2007-12-07 Thread Lars Johansen
I have a function that looks like this: def Chooser(color): if color == RED: x = term.RED elif color == BLUE: x = term.BLUE elif color == GREEN: x = term.GREEN elif color == YELLOW: x = term.YELLOW

Re: Any simpler way to do this

2007-12-07 Thread Christian Heimes
Lars Johansen wrote: I have a function that looks like this: def Chooser(color): if color == RED: x = term.RED elif color == BLUE: x = term.BLUE elif color == GREEN: x = term.GREEN elif color == YELLOW:

Re: Any simpler way to do this

2007-12-07 Thread Bruno Desthuilliers
Lars Johansen a écrit : I have a function that looks like this: def Chooser(color): mode=pedant Bad naming (noun instead of a verb) and not conformant to PEP 08 (function names should be all_lower) /mode if color == RED: x = term.RED elif color == BLUE:

Re: Any simpler way to do this

2007-12-07 Thread Virgil Dupras
On Dec 7, 9:37 am, Lars Johansen [EMAIL PROTECTED] wrote: I have a function that looks like this: def Chooser(color): if color == RED: x = term.RED elif color == BLUE: x = term.BLUE elif color == GREEN: x =

Re: Any simpler way to do this

2007-12-07 Thread Tim Golden
Lars Johansen wrote: I have a function that looks like this: def Chooser(color): if color == RED: x = term.RED elif color == BLUE: x = term.BLUE elif color == GREEN: x = term.GREEN elif color == YELLOW:

Re: Any simpler way to do this

2007-12-07 Thread Chris
On Dec 7, 10:37 am, Lars Johansen [EMAIL PROTECTED] wrote: I have a function that looks like this: def Chooser(color): if color == RED: x = term.RED elif color == BLUE: x = term.BLUE elif color == GREEN: x =

Re: Any simpler way to do this

2007-12-07 Thread Steven D'Aprano
On Fri, 07 Dec 2007 09:37:22 +0100, Lars Johansen wrote: I have a function that looks like this: def Chooser(color): if color == RED: x = term.RED [snip] Wouldn there been easier if I could just skip all the *if's and just return term.color, however this gives a