Implicit conversion to boolean in if and while statements

Laszlo Nagy gandalf at shopzeus.com
Mon Jul 16 23:26:18 CEST 2012


> This syntax is explicit *enough*. We don't need to be any more
> explicit.
>
> But if you are going to argue that "if obj" is *explicit enough*, then
> apply your argument consistently to "String"+1.75 also. Why must we be
> explicit about string conversion BUT not boolean conversion? Can you
> reduce this to the absurd? Or will you just choose to ignore this
> valid point?
Not all decisions in Python are based purely on the "explicit enough" 
thing. Some things in the language cannot be explained using 
explicitness alone. So, when we cannot fully explain the ' why 
String+1.75 ' question with statements about explicitness then it 
doesn't mean that anybody lied or wrote something wrong. :-)





More information about the Python-list mailing list