[Numpy-discussion] ENH: Uniform interface for accessing minimum or maximum value of a dtype
As discussed [here](https://github.com/numpy/numpy/issues/5032#issuecomment-1830838701), [here](https://github.com/numpy/numpy/issues/5032#issuecomment-2307927804), and [here](https://github.com/google/jax/issues/18661#issuecomment-1829031914), I'm interested in a uniform interface for accessing the minimum or maximum value of a given dtype. Currently, this requires branching on the type of dtype (boolean, integer, or floating point) and then (for the latter two) calling either [iinfo](https://numpy.org/doc/stable/reference/generated/numpy.iinfo.html) or [finfo](https://numpy.org/doc/stable/reference/generated/numpy.finfo.html), respectively. It would be more ergonomic to have a single, uniform interface for accessing this information that is dtype-independent. Possible interfaces include: ```python3 import numpy as np dt = np.dtype('int32') dt.min np.dtypes.info(dt).min np.dtypes.min(dt) np.dtypes.min_value(dt) ``` ___ 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: ENH: Uniform interface for accessing minimum or maximum value of a dtype
+1 for the general idea! It may be nice to have such a function which sits at the top level of the API, to fit into https://data-apis.org/array-api/draft/API_specification/data_type_functions.html nicely. However, ‘min_value’ or ‘min‘ won’t do then - we’d probably need to include ‘dtype’ in the name somewhere. But I don’t really like `np.min_dtype(dt)`. Maybe `np.min_dtype_value(dt)`? Cheers, Lucas > On 25 Aug 2024, at 20:59, Carlos Martin wrote: > > As discussed > [here](https://github.com/numpy/numpy/issues/5032#issuecomment-1830838701), > [here](https://github.com/numpy/numpy/issues/5032#issuecomment-2307927804), > and > [here](https://github.com/google/jax/issues/18661#issuecomment-1829031914), > I'm interested in a uniform interface for accessing the minimum or maximum > value of a given dtype. > > Currently, this requires branching on the type of dtype (boolean, integer, or > floating point) and then (for the latter two) calling either > [iinfo](https://numpy.org/doc/stable/reference/generated/numpy.iinfo.html) or > [finfo](https://numpy.org/doc/stable/reference/generated/numpy.finfo.html), > respectively. It would be more ergonomic to have a single, uniform interface > for accessing this information that is dtype-independent. > > Possible interfaces include: > > ```python3 > import numpy as np > dt = np.dtype('int32') > > dt.min > np.dtypes.info(dt).min > np.dtypes.min(dt) > np.dtypes.min_value(dt) > ``` > ___ > 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: lucas.coll...@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] next NumPy community meeting - August 28th, 2024 at 6 pm UTC
The next NumPy community meeting will be held this Wednesday, August 28th at 6 pm UTC. Join us via Zoom: https://numfocus-org.zoom.us/j/83278611437?pwd=ekhoLzlHRjdWc0NOY2FQM0NPemdkZz09 . Everyone is welcome and encouraged to attend. To add to the meeting agenda the topics you’d like to discuss, follow the link: https://hackmd.io/76o-IxCjQX2mOXO_wwkcpg?both. For the notes from the previous meetings, visit: https://github.com/numpy/archive/tree/main/community_meetings. -- Cheers, Inessa Inessa Pawson GitHub: inessapawson ___ 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: next Documentation team meeting
Hi all, Our next Documentation Team meeting will happen on *Monday, August 26* at *7PM UTC*. All are welcome - you don't need to already be a contributor to join. If you have questions or are curious about what we're doing, we'll be happy to meet you! If you wish to join on Zoom, use this (updated) link: https://numfocus-org.zoom.us/j/85016474448?pwd=TWEvaWJ1SklyVEpwNXUrcHV1YmFJQ... Here's the permanent hackmd document with the meeting notes (still being updated): https://hackmd.io/oB_boakvRqKR-_2jRV-Qjg Hope to see you around! Best wishes, Mukulika ___ 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