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

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 col

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): Bad naming (noun instead of a verb) and not conformant to PEP 08 (function names should be all_lower) > if color == "RED": > x = term.RED > elif color == "BLUE": >

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": >

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": >

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 col

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.YE