[Numpy-discussion] Why are empty arrays False?

Benjamin Root ben.v.root at gmail.com
Mon Aug 21 10:34:22 EDT 2017


I've long ago stopped doing any "emptiness is false"-type tests on any
python containers when iterators and generators became common, because they
always return True.

Ben

On Sat, Aug 19, 2017 at 6:05 PM, Marten van Kerkwijk <
m.h.vankerkwijk at gmail.com> wrote:

> Agreed with Eric Wieser here have an empty array test as `False` is
> less than useless, since a non-empty array either returns something
> based on its contents or an error. This means that one cannot write
> statements like `if array:`. Does this leave any use case? It seems to
> me it just shows there is no point in defining the truthiness of an
> empty array.
> -- Marten
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170821/9f721e09/attachment.html>


More information about the NumPy-Discussion mailing list