Why bool( object )?
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Fri May 1 00:30:19 EDT 2009
In message <pan.2009.04.30.00.29.35 at REMOVE.THIS.cybersource.com.au>, Steven
D'Aprano wrote:
> The reason why Lawrence's insistence is so badly wrong becomes more
> apparent if you look at what you can do with boolean contexts other than
> simple `if` tests. Compare:
>
>
> for x in a or b or c:
> do_something_with(x)
>
>
> versus:
>
>
> if len(a) > 0:
> temp = a
> elif len(b) > 0:
> temp = b
> elif len(c) > 0:
> temp = c
> for x in temp:
> do_something_with(x)
I have never written anything so unbelievable in my life. And I hope I never
will.
More information about the Python-list
mailing list