Strings and the and operator: best practice, differences with +
<p>For one of my sites, I need to check if several class attributes are defined and not empty. So far, I've happily used <code>if self.attr:</code>, which in my mind is the shorthand for <code>if self.attr is not None and self.attr is not '':</code>, or whatever the undefined value of the attribute is.</p>

<p>This works fine, but yields to surprising behavior when checking multiple string attributes. <code>'' and ''</code> is not <code>False</code> (as I expected), but <code>''</code>. </p>

<p>This begs the question: are there other types for which the <code>and</code> operator does not force a typecast to <code>bool</code>? 
I can't come up with an example where this difference in behavior would cause an actual different outcome for the <code>if</code>-clause (after all, <code>''</code> still evaluates to <code>False</code>), but am left with the gut feeling that there's edge cases that could be a trap.</p>

<p>Lastly, I'd be keen to know if anybody knows why it was implemented that way? I thought the Zen of Python encourages one way and one way only, and the <code>+</code> operator already seems to bethe intuitive way for string concatenation.</p>
