Why bool( object )?

Hendrik van Rooyen mail at microcorp.co.za
Fri May 1 11:05:08 CEST 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