How to code a series of alternatives

Scott F sdfATexpertuneDOTcom
Mon Feb 23 13:44:04 EST 2004


aahz at pythoncraft.com (Aahz) wrote in
news:c1dhgu$orm$1 at panix3.panix.com: 

> 
> Simplest:
> 
>     if testvar in ('fred', 'bob'):
> 
> Fastest:
> 
>     options = sets.Set('fred', 'bob'):
> 
>         ...
> 
>     if testvar in options:


Thank you.  I'd be embarassed, but I'm only grateful.  

Scott




More information about the Python-list mailing list