[Numpy-discussion] Re: C API could be more consistent with returning NPY_SUCCEED/NPY_FAIL
The Python C-API almost exclusively uses `-1` for errors and I consider it a wart that some NumPy API uses `NPY_FAIL`/`NPY_SUCCEED`, i would not do this for new API. The one exception are all "argument parsing functions". For those Python again dictates the use of 0 (NPY_FAIL) and 1 (NPY_SUCCEED). And while a big exception, yes there is API that should have used the 0 for success and -1 for error convention, but did not... There is no issue anywhere, mainly because I don't think anyone really considered changing API, since it would require simply duplicating functions which is also confusing. I.e. sure, it's bad, but what is the actionable item? - Sebastian On Thu, 2024-10-31 at 11:53 +, sverre.hassing--- via NumPy- Discussion wrote: > While using the C API to work with Numpy arrays, I came across some > inconsistencies regarding the return of a success state from various > Numpy functions. For example, the array iterator functions return > either NPY_SUCCEED (defined as 1) or NPY_FAIL (defined as 0) to > indicate whether the function successfully finished. However, various > of the array functions return -1 on success and 0 on failure. The > result is similar enough, but I would think it more consistent to use > NPY_SUCCEED/NPY_FAIL everywhere. As an example, consider the > documentation pages for the Array API: > https://numpy.org/doc/stable/reference/c-api/array.html > and the Array iterator API: > https://numpy.org/doc/stable/reference/c-api/iterator.html#array-iterator-api > > I hope this is the right place to place this. It is the first time I > really publicly engage with this kind of thing. This did not seem > like a bug and the Github page indicated that feature requests should > go to the mailing list first. > ___ > NumPy-Discussion mailing list -- numpy-discussion@python.org > To unsubscribe send an email to numpy-discussion-le...@python.org > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ > Member address: sebast...@sipsolutions.net > ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com
[Numpy-discussion] Re: How do I use the numpy on spyder?
Nowadays, free AIs are good for such questions: https://www.youtube.com/watch?v=bA-tbHwvA6A hth On Thu, Oct 31, 2024 at 9:31 AM Joao Pereira via NumPy-Discussion < numpy-discussion@python.org> wrote: > I don´t know how to use the numpy on spyder. I have tried to use this > line: "import numpy as np" but i dont know if it's the only necessary thing > to do. > If you could explain it to me I'll appreciate it. > ___ > NumPy-Discussion mailing list -- numpy-discussion@python.org > To unsubscribe send an email to numpy-discussion-le...@python.org > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ > Member address: alan.is...@gmail.com > ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com
[Numpy-discussion] C API could be more consistent with returning NPY_SUCCEED/NPY_FAIL
While using the C API to work with Numpy arrays, I came across some inconsistencies regarding the return of a success state from various Numpy functions. For example, the array iterator functions return either NPY_SUCCEED (defined as 1) or NPY_FAIL (defined as 0) to indicate whether the function successfully finished. However, various of the array functions return -1 on success and 0 on failure. The result is similar enough, but I would think it more consistent to use NPY_SUCCEED/NPY_FAIL everywhere. As an example, consider the documentation pages for the Array API: https://numpy.org/doc/stable/reference/c-api/array.html and the Array iterator API: https://numpy.org/doc/stable/reference/c-api/iterator.html#array-iterator-api I hope this is the right place to place this. It is the first time I really publicly engage with this kind of thing. This did not seem like a bug and the Github page indicated that feature requests should go to the mailing list first. ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com
[Numpy-discussion] How do I use the numpy on spyder?
I don´t know how to use the numpy on spyder. I have tried to use this line: "import numpy as np" but i dont know if it's the only necessary thing to do. If you could explain it to me I'll appreciate it. ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com