#20501·numpy

DOC: Docs suggest returned `iinfo`/`finfo` attributes are Python scalars, not NumPy scalars

Author: honnoCreated Dec 2, 2021Updated Sep 30, 2026
Labels00 - Bugsustain-2026

Describe the issue:

np.finfo() and np.iinfo() document some returned attributes with int or float, when actually they return NumPy scalars.

This behaviour makes sense, as beyond 64bits you could not represent some of these attributes with Python scalars. However I think it's important the docs note this, as a user might expect a Python scalar. This tripped me up recently (HypothesisWorks/hypothesis#3156) as a CI job was failing due to an unexpected NumPy scalar from np.finfo(float32).tiny—I had just assumed the docs meant Python scalars so didn't immediately recognise the problem.

@mattip suggested something like changing

tiny: float

to

tiny: floating point number of the appropriate type

How does using that language sound for all the attributes?

Reproduce the code example:

python
>>> type(np.finfo(np.float32).tiny)
numpy.float32  # I expected a Python float - probably the doc should change
>>> type(np.finfo(np.float128).tiny)
numpy.float128  # could not be represented as a Python float

NumPy/Python version information:

1.23.0.dev0+81.gc8fdb53ee 3.9.9 (main, Nov 16 2021, 03:08:02)