<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 22, 2017 at 11:04 AM, Michael Lamparski <span dir="ltr"><<a href="mailto:diagonaldevice@gmail.com" target="_blank">diagonaldevice@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div>I think truthiness is easily a wart in any dynamically-typed language (and yet ironically, every language I can think of that has truthiness is dynamically typed except for C++).  And yet for some reason it seems to be pressed forward as idiomatic in python, and for that reason alone, I use it. </div></span></div></blockquote><div><br></div><div>me too :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div>Meanwhile, for an arbitrary iterator taken as an argument, if you want it to have at least one element for some reason, then good luck; truthiness will not help you.</div></span></div></blockquote><div><br></div><div>of course, nor will len() </div><div><br></div><div>And this is mostly OK, as if you are taking an aritrary iterable, then you are probably going to, well, iterate over it, and:</div><div><br></div><div>for this in an_empty_iterable:</div><div>    ...</div><div><br></div><div>works fine.</div><div><br></div><div>But bringing it  back OT -- it's all a bit messy, but there is logic for the existing conventions in numpy -- and I think backward compatibility is more important than a slightly cleaner API.</div><div><br></div><div>-CHB</div><div><br></div><div><br></div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>