[Numpy-discussion] Why are empty arrays False?

Michael Lamparski diagonaldevice at gmail.com
Sat Aug 19 13:18:45 EDT 2017


On Sat, Aug 19, 2017 at 9:22 AM, Pauli Virtanen <pav at iki.fi> wrote:
> While the intention of making it harder to write code with bugs
> is good, it should not come at the cost of having everyone fix
> their old scripts, which worked correctly previously, but then
> suddenly stop working.

This is a good point.  Deprecating anything in such a widely used library
has a very big cost that must be weighed against the benefits, and I agree
that truth-testing on size=1 arrays is neither broken nor dangerous. IMO,
it is a small refactoring hazard at worst.

> Note also that I expect polling on this mailing list will not
> reach the majority of the user base, [...]

Yep.  This thread was really just to test the waters.

While there's no way to really reach out to the silent majority, I am going
to at least make a github issue and summarize the points from this
discussion there.  I'm glad to see that the general response so far has
been that this seems actionable (specifically, deprecating __nonzero__ on
size=0 arrays).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170819/af987635/attachment.html>


More information about the NumPy-Discussion mailing list