On 8/23/21 1:15 PM, Tim Hoffmann via Python-ideas wrote:

> If you want to write a function that accepts array-like `values`, you have to 
change
> a check `if values` to `if len(values) == 0`. That works for both but is 
against the
> PEP8 recommendation. This is a shortcoming of the language.

Numpy is not Python, but a specialist third-party package that has made specialist choices about basic operations -- that does not sound like a shortcoming of the language.

It seems to me that the appropriate fix is for numpy to have an "is_empty()" function that knows how to deal with arrays and array-like structures, not force every container to grow a new method.

--
~Ethan~
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/IHCXG7X5YPJWPRVZVXR3RGCCN43UV7MC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to