MCPcopy Index your code
hub / github.com/RustPython/RustPython / slice_shape

Function slice_shape

Lib/test/test_buffer.py:365–370  ·  view source on GitHub ↗

Get the shape of lst after slicing: slices is a list of slice objects.

(lst, slices)

Source from the content-addressed store, hash-verified

363 return _flatten(lst)
364
365def slice_shape(lst, slices):
366 """Get the shape of lst after slicing: slices is a list of slice
367 objects."""
368 if atomp(lst):
369 return []
370 return [len(lst[slices[0]])] + slice_shape(lst[0], slices[1:])
371
372def multislice(lst, slices):
373 """Multi-dimensional slicing: slices is a list of slice objects."""

Callers 1

cmp_structureFunction · 0.85

Calls 2

atompFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected