On Tue, 08 Dec 2009 21:02:44 -0800, Kee Nethery wrote:

> I string together a bunch of elif statements to simulate a switch
> 
> if foo == True:
>       blah
> elif bar == True:
>       blah blah
> elif bar == False:
>       blarg
> elif ....


Are you sure you want to test for equality with True and False? Generally 
one should write that as:

if foo:
    blah
elif bar:
    blah blah
elif not bar:
    blarg
...




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to