This is a pre-release version (latest).Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / lib / _arraypad_impl / _slice_at_axis

function

numpy.lib._arraypad_impl:_slice_at_axis

source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_arraypad_impl.py:34

Signature

def _slice_at_axis(sl, axis)

Summary

Construct tuple of slices to slice an array in the given dimension.

Parameters

sl : slice

The slice for the given dimension.

axis : int

The axis to which sl is applied. All other dimensions are left "unsliced".

Returns

sl : tuple of slices

A tuple with slices matching shape in length.

Examples

np._slice_at_axis(slice(None, 3, -1), 1)
⚠
Traceback (most recent call last):
  File "<doctest numpy.lib._arraypad_impl:_slice_at_axis[0]>", line 1, in <module>
    np._slice_at_axis(slice(None, 3, -1), 1)
    ^^^^^^^^^^^^^^^^^
  File "/home/runner/dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/__init__.py", line 792, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute '_slice_at_axis'

Aliases

  • numpy.lib._arraypad_impl._slice_at_axis