-
-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Description
A nice bonus of #12251 is that we now set __module__ on functions decorated with array_function_dispatch to NumPy's preferred public API.
This means that IPython (but not Python's built-in repr() now displays a better summary for NumPy fucntions: <function 'numpy.sum'> vs the current <function 'numpy.core.fromnumeric.sum'>.
This is s a nice subtle way to encourage people not to dive into NumPy's internals.
It would be nice to finish this for the rest of NumPy's public API. Here's a little function I wrote to do these checks:
def check_module(module):
for name in dir(module):
item = getattr(module, name)
if hasattr(item, '__module__') and hasattr(item, '__name__'):
print(f'{item.__module__}.{item.__name__}')and the current output for check_module(numpy) (with the changes from #12270 included):
numpy.core._internal.AxisError
numpy.core.numeric.ComplexWarning
numpy.lib._datasource.DataSource
numpy.core.machar.MachAr
numpy._globals.ModuleDeprecationWarning
numpy.lib.polynomial.RankWarning
numpy.testing._private.nosetester.NoseTester
numpy.core._internal.TooHardError
numpy._globals.VisibleDeprecationWarning
numpy.core._multiarray_umath._add_newdoc_ufunc
numpy.core._multiarray_umath.add_docstring
numpy.core.function_base.add_newdoc
numpy.core._multiarray_umath._add_newdoc_ufunc
numpy.alen
numpy.all
numpy.allclose
numpy.alltrue
numpy.amax
numpy.amin
numpy.angle
numpy.any
numpy.append
numpy.apply_along_axis
numpy.apply_over_axes
numpy.core._multiarray_umath.arange
numpy.argmax
numpy.argmin
numpy.argpartition
numpy.argsort
numpy.argwhere
numpy.around
numpy.core._multiarray_umath.array
numpy.array2string
numpy.array_equal
numpy.array_equiv
numpy.array_repr
numpy.array_split
numpy.array_str
numpy.core.numeric.asanyarray
numpy.core.numeric.asarray
numpy.lib.function_base.asarray_chkfinite
numpy.core.numeric.ascontiguousarray
numpy.lib.type_check.asfarray
numpy.core.numeric.asfortranarray
numpy.matrixlib.defmatrix.asmatrix
numpy.asscalar
numpy.atleast_1d
numpy.atleast_2d
numpy.atleast_3d
numpy.average
numpy.lib.function_base.bartlett
numpy.core.numeric.base_repr
numpy.core.numeric.binary_repr
numpy.core._multiarray_umath.bincount
numpy.lib.function_base.blackman
numpy.block
numpy.matrixlib.defmatrix.bmat
builtins.bool
numpy.bool_
numpy.bool_
numpy.broadcast
numpy.broadcast_arrays
numpy.broadcast_to
numpy.busday_count
numpy.busday_offset
numpy.busdaycalendar
numpy.int8
numpy.lib.utils.byte_bounds
numpy.bytes_
numpy.bytes_
numpy.can_cast
numpy.complex128
numpy.complex128
numpy.character
numpy.core.defchararray.chararray
numpy.choose
numpy.clip
numpy.complex256
numpy.complex256
numpy.column_stack
numpy.common_type
numpy.core._multiarray_umath.compare_chararrays
builtins.complex
numpy.complex128
numpy.complex256
numpy.complex64
numpy.complex128
numpy.complexfloating
numpy.compress
numpy.concatenate
numpy.convolve
numpy.copy
numpy.core._multiarray_umath.copyto
numpy.corrcoef
numpy.correlate
numpy.count_nonzero
numpy.cov
numpy.cross
numpy.complex64
numpy.cumprod
numpy.cumproduct
numpy.cumsum
numpy.datetime64
numpy.datetime_as_string
numpy.core._multiarray_umath.datetime_data
numpy.delete
numpy.lib.utils.deprecate
numpy.lib.utils.<lambda>
numpy.diag
numpy.lib.index_tricks.diag_indices
numpy.diag_indices_from
numpy.diagflat
numpy.diagonal
numpy.diff
numpy.digitize
numpy.lib.function_base.disp
numpy.dot
numpy.float64
numpy.dsplit
numpy.dstack
numpy.dtype
numpy.ediff1d
numpy.einsum
numpy.einsum_path
numpy.core._multiarray_umath.empty
numpy.empty_like
numpy.core.numeric.errstate
numpy.expand_dims
numpy.extract
numpy.lib.twodim_base.eye
numpy.core._multiarray_umath._fastCopyAndTranspose
numpy.fill_diagonal
numpy.core.numerictypes.find_common_type
numpy.core.getlimits.finfo
numpy.fix
numpy.flatiter
numpy.flatnonzero
numpy.flexible
numpy.flip
numpy.fliplr
numpy.flipud
builtins.float
numpy.float128
numpy.float16
numpy.float32
numpy.float64
numpy.float64
numpy.floating
numpy.core.arrayprint.format_float_positional
numpy.core.arrayprint.format_float_scientific
numpy.core.records.format_parser
numpy.core._multiarray_umath.frombuffer
numpy.core._multiarray_umath.fromfile
numpy.core.numeric.fromfunction
numpy.core._multiarray_umath.fromiter
numpy.core._multiarray_umath.frompyfunc
numpy.lib.npyio.fromregex
numpy.core._multiarray_umath.fromstring
numpy.core.numeric.full
numpy.full_like
numpy.fv
numpy.generic
numpy.lib.npyio.genfromtxt
numpy.core.function_base.geomspace
numpy.lib.shape_base.get_array_wrap
numpy.lib.utils.get_include
numpy.core.arrayprint.get_printoptions
numpy.core.numeric.getbufsize
numpy.core.numeric.geterr
numpy.core.numeric.geterrcall
numpy.core._multiarray_umath.geterrobj
numpy.gradient
numpy.float16
numpy.lib.function_base.hamming
numpy.lib.function_base.hanning
numpy.lib.histograms.histogram
numpy.histogram2d
numpy.lib.histograms.histogram_bin_edges
numpy.lib.histograms.histogramdd
numpy.hsplit
numpy.hstack
numpy.i0
numpy.core.numeric.identity
numpy.core.getlimits.iinfo
numpy.imag
numpy.lib.arraysetops.in1d
numpy.core.numeric.indices
numpy.inexact
numpy.lib.utils.info
numpy.inner
numpy.insert
builtins.int
numpy.int64
numpy.int16
numpy.int32
numpy.int64
numpy.int8
numpy.int64
numpy.core._multiarray_umath.int_asbuffer
numpy.int32
numpy.integer
numpy.interp
numpy.intersect1d
numpy.int64
numpy.ipmt
numpy.irr
numpy.is_busday
numpy.isclose
numpy.iscomplex
numpy.iscomplexobj
numpy.core.numeric.isfortran
numpy.isin
numpy.isneginf
numpy.isposinf
numpy.isreal
numpy.isrealobj
numpy.core.numeric.isscalar
numpy.core.numerictypes.issctype
numpy.core.numerictypes.issubclass_
numpy.core.numerictypes.issubdtype
numpy.core.numerictypes.issubsctype
numpy.lib.function_base.iterable
numpy.ix_
numpy.lib.function_base.kaiser
numpy.kron
numpy.lexsort
numpy.core.function_base.linspace
numpy.lib.npyio.load
numpy.lib.npyio.loads
numpy.lib.npyio.loadtxt
numpy.core.function_base.logspace
builtins.int
numpy.complex256
numpy.float128
numpy.float128
numpy.int64
numpy.lib.utils.lookfor
numpy.lib.npyio.mafromtxt
numpy.lib.twodim_base.mask_indices
numpy.matrixlib.defmatrix.asmatrix
numpy.core._multiarray_umath.matmul
numpy.matrixlib.defmatrix.matrix
numpy.amax
numpy.core.numerictypes.maximum_sctype
numpy.core._multiarray_umath.may_share_memory
numpy.mean
numpy.median
numpy.core.memmap.memmap
numpy.meshgrid
numpy.amin
numpy.min_scalar_type
numpy.lib.type_check.mintypecode
numpy.mirr
numpy.moveaxis
numpy.msort
numpy.nan_to_num
numpy.nanargmax
numpy.nanargmin
numpy.nancumprod
numpy.nancumsum
numpy.nanmax
numpy.nanmean
numpy.nanmedian
numpy.nanmin
numpy.nanpercentile
numpy.nanprod
numpy.nanquantile
numpy.nanstd
numpy.nansum
numpy.nanvar
numpy.ndarray
numpy.lib.index_tricks.ndenumerate
numpy.lib.npyio.ndfromtxt
numpy.ndim
numpy.lib.index_tricks.ndindex
numpy.nditer
numpy.core._multiarray_umath.nested_iters
numpy.nonzero
numpy.nper
numpy.npv
numpy.number
numpy.core.numerictypes.obj2sctype
builtins.object
numpy.object_
numpy.object_
numpy.core.numeric.ones
numpy.ones_like
numpy.outer
numpy.core._multiarray_umath.packbits
numpy.pad
numpy.partition
numpy.percentile
numpy.piecewise
numpy.place
numpy.pmt
numpy.poly
numpy.lib.polynomial.poly1d
numpy.polyadd
numpy.polyder
numpy.polydiv
numpy.polyfit
numpy.polyint
numpy.polymul
numpy.polysub
numpy.polyval
numpy.ppmt
numpy.core.arrayprint.printoptions
numpy.prod
numpy.product
numpy.core._multiarray_umath.promote_types
numpy.ptp
numpy.put
numpy.put_along_axis
numpy.core._multiarray_umath.putmask
numpy.pv
numpy.quantile
numpy.rank
numpy.rate
numpy.ravel
numpy.core._multiarray_umath.ravel_multi_index
numpy.real
numpy.real_if_close
numpy.recarray
numpy.lib.npyio.recfromcsv
numpy.lib.npyio.recfromtxt
numpy.record
numpy.repeat
numpy.core.numeric.require
numpy.reshape
numpy.resize
numpy.result_type
numpy.roll
numpy.rollaxis
numpy.roots
numpy.rot90
numpy.round_
numpy.round_
numpy.vstack
numpy.lib.utils.safe_eval
numpy.lib.npyio.save
numpy.lib.npyio.savetxt
numpy.lib.npyio.savez
numpy.lib.npyio.savez_compressed
numpy.core.numerictypes.sctype2char
numpy.searchsorted
numpy.select
numpy.core._multiarray_umath.set_numeric_ops
numpy.core.arrayprint.set_printoptions
numpy.core.arrayprint.set_string_function
numpy.core.numeric.setbufsize
numpy.setdiff1d
numpy.core.numeric.seterr
numpy.core.numeric.seterrcall
numpy.core._multiarray_umath.seterrobj
numpy.setxor1d
numpy.shape
numpy.core._multiarray_umath.shares_memory
numpy.int16
numpy.__config__.show
numpy.signedinteger
numpy.sinc
numpy.float32
numpy.complex64
numpy.size
numpy.sometrue
numpy.sort
numpy.sort_complex
numpy.lib.utils.source
numpy.split
numpy.squeeze
numpy.stack
numpy.std
builtins.str
numpy.str_
numpy.str_
numpy.bytes_
numpy.sum
numpy.swapaxes
numpy.take
numpy.take_along_axis
numpy.tensordot
numpy.tile
numpy.timedelta64
numpy.trace
numpy.transpose
numpy.trapz
numpy.lib.twodim_base.tri
numpy.tril
numpy.lib.twodim_base.tril_indices
numpy.tril_indices_from
numpy.trim_zeros
numpy.triu
numpy.lib.twodim_base.triu_indices
numpy.triu_indices_from
numpy.lib.type_check.typename
numpy.uint8
numpy.ufunc
numpy.uint64
numpy.uint64
numpy.uint16
numpy.uint32
numpy.uint64
numpy.uint8
numpy.uint32
numpy.uint64
numpy.uint64
builtins.str
numpy.str_
numpy.union1d
numpy.unique
numpy.core._multiarray_umath.unpackbits
numpy.core._multiarray_umath.unravel_index
numpy.unsignedinteger
numpy.unwrap
numpy.uint16
numpy.vander
numpy.var
numpy.vdot
numpy.lib.function_base.vectorize
numpy.void
numpy.void
numpy.vsplit
numpy.vstack
numpy.where
numpy.lib.utils.who
numpy.core._multiarray_umath.zeros
numpy.zeros_like
Metadata
Metadata
Assignees
Labels
No labels