Why bool( object )?

Hendrik van Rooyen mail at microcorp.co.za
Fri May 1 05:05:08 EDT 2009


"Paul Rubin" <http://phr.cx@NOSPAM.invalid> wrote:


> Steven D'Aprano <stev at source.com.au> writes:
> > for x in a or b or c:
> >     do_something_with(x)
> 
> Ugh!!!!
> 
>   for x in [a,b,c]:
>      if len(x) > 0:
>        do_something_with(x)
>        break
> 
Ugh!!!!

for x in [a,b,c]:
    if x:
    do_something_with(x)
    break

:-)

- Hendrik




More information about the Python-list mailing list