diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-10-04 21:01:54 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2020-10-04 21:01:54 +0100 |
commit | 2877fb04ecd9816edadac9d42555e06aaa807f2d (patch) | |
tree | eed2bf7e05bdc08080198c412efbe54788a5f191 /numpy/lib/index_tricks.py | |
parent | 5ee77370b92f24b06a221774c6b1c4292e6b09ef (diff) | |
download | numpy-2877fb04ecd9816edadac9d42555e06aaa807f2d.tar.gz |
DOC: Change the value of type.__name__ on the scalar types for sphinx builds
By default, the `.__name__` of the numeric `np.generic` subclasses is their bitlength name, such as `np.int64`.
This is convenient when working interactively, because it lets users see the size of their array easily; but in docs it is confusing, as the sizes of the integers in the doc build may not match their size on the platform of the user reading them.
Without this change, `..autoclass:: numpy.short` would just display "alias of uint16", which is backwards.
Rather than changing the names globally, or adding a build flag to change the names, this uses `ctypes` to modify the scalar names at startup.
This resembles the approach taken by the `forbiddenfruit` module for patching builtin slots, although that would be overkill here.
The timing of when we perform this patching is important - we can't do it until after `numpy.core._umath_multiarray` has been loaded, but we need to do it before `numpy.core._add_newdocs` generates the name-based docstrings.
Similarly, we can't just disable `numpy.core._add_newdocs` until later, as it populates docstrings in `ndarray` on which `numpy.ma.core` does further processing.
To resolve this, we split out the scalar docstrings in `numpy.core._add_newdocs` into a new module `numpy.core._add_newdocs_scalars` that _is_ safe to disable until later.
Diffstat (limited to 'numpy/lib/index_tricks.py')
0 files changed, 0 insertions, 0 deletions