<p dir="ltr">Andrew, that can only be useful if you also require that all non-empty arrays are True - else code looking for empty arrays gets false positives on arrays of zeros.</p>
<p dir="ltr">But as I mention above, that is not acceptable, as it produces silent traps for new users, or functions not written with numpy in mind. "In the face of ambiguity, refuse the tempting to guess" tells us that throwing an error is the right thing to do here.</p>
<p dir="ltr">In idiomatic code, numpy arrays have semantics closer to scalars than to sequences - iteration is usually a red flag. Another example of how arrays are not like sequences - the + operator is element-wise addition, not sequence concatenation.</p>
<br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 19, 2017, 15:58 Andrew Nelson <<a href="mailto:andyfaff@gmail.com">andyfaff@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><span style="font-family:sans-serif;font-size:13.696px">> I think the consistency between bool([]) and</span><br style="font-family:sans-serif;font-size:13.696px"><span style="font-family:sans-serif;font-size:13.696px">bool(array([])) is worth preserving</span><div dir="auto"><span style="font-family:sans-serif;font-size:13.696px"><br></span></div></div></div><div dir="auto"><div><div dir="auto"><span style="font-family:sans-serif;font-size:13.696px">I'm with Eric Firing on this one. Empty sequences are False in Python.</span></div><div dir="auto"><span style="font-family:sans-serif;font-size:13.696px"><br></span></div><div dir="auto"><span style="font-family:sans-serif;font-size:13.696px"><br></span></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-1154967168530184711quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote></div></div></div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>