bool behavior in Python 3000?

Stargaming stargaming at gmail.com
Thu Jul 12 03:46:16 EDT 2007


Steven D'Aprano schrieb:
> On Wed, 11 Jul 2007 08:04:33 +0200, Stargaming wrote:
> 
> 
> 
>>No, I think Bjoern just wanted to point out that all those binary 
>>boolean operators already work *perfectly*. You just have to emphasize 
>>that you're doing boolean algebra there, using `bool()`.
>>"Explicit is better than implicit."
> 
> 
> 
> So we should always write things explicitly like:
> 
> if bool(bool(some_condition) is True) is True:
>     first_line = str(some_string).split(str("\n"))[int(0)]
>     n = int(int(len(list(some_list))) + int(1))
> elif bool(bool(some_condition) is False) is True:
>     f = float(math.sin(float(6.0)/float(math.pi)))
> 
> instead of the less explicit code. I'll try to remember that, thank you
> for the advice.
> 
> 
> 

You're missing like 400 bool(...) is True constructs there! Fatal error, 
recursion depth reached. Aww!



More information about the Python-list mailing list