<div class="gmail_quote">On Thu, Oct 6, 2011 at 1:22 PM, Daniel Drake <span dir="ltr"><<a href="mailto:dsd@laptop.org">dsd@laptop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Oct 6, 2011 at 6:13 PM, Frederick Grose <<a href="mailto:fgrose@gmail.com">fgrose@gmail.com</a>> wrote:<br>
> But try this:<br>
> foo = 0<br>
> if foo:<br>
> print 'foo is not None'<br>
<br>
</div>Yes, I'm aware that the boolean operator also has meaning for<br>
numerical values. But that doesn't affect my patch and the context of<br>
this code. Or am I missing something?<br>
<br>
Thanks,<br>
<font color="#888888">Daniel<br></font></blockquote><div><br></div><div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<span style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">"foo" alone as a boolean operator is an equivalent length check,<br></span><span style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">and also serves as a "is not None" check too.</span></blockquote>
<div><br></div><div>No, you are not missing something, but the casual reader may want to take note that if foo: serves only as a "is not None or is zero" check.</div><div><br></div><div>So if foo is not None: is a more robust check for that singular condition.</div>
<div><br></div><div>That's all, just an aside. Thanks. --Fred</div><div> </div></div><div> </div></div><br>