Python Idioms [pdf]
Interesting philosophical points.<p>To me personally, testing for 'truthy' and 'falsy' values, or relying on exceptions rather than checking values in advance, feels like sloppy and imprecise programming.<p>A string being empty or not, or an array having items or not, or a boolean being true or false, are all qualitatively totally different things to me -- and just because Python <i>can</i> treat them the same, doesn't mean a programmer <i>should</i> take advantage of that fact. Sometimes it's possible to <i>over</i>-simplify things in a way that obfuscates instead of clarifying.<p>When I read:<p><pre><code>    if name and pets and owners
</code></pre>
I have no intuitive idea of what that means, of what's going on in the program. When I read<p><pre><code>    if name != '' and len(pets) > 0 and owners != {}
</code></pre>
I understand it exactly.<p>But by this point, I've come to understand that, for a lot of people, it seems to be the opposite. It seems to be more of a philosophical difference, not right/wrong.