MCPcopy Index your code
hub / github.com/python/cpython / slice_shape

Function slice_shape

Lib/test/test_buffer.py:377–382  ·  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

375 return _flatten(lst)
376
377def slice_shape(lst, slices):
378 """Get the shape of lst after slicing: slices is a list of slice
379 objects."""
380 if atomp(lst):
381 return []
382 return [len(lst[slices[0]])] + slice_shape(lst[0], slices[1:])
383
384def multislice(lst, slices):
385 """Multi-dimensional slicing: slices is a list of slice objects."""

Callers 1

cmp_structureFunction · 0.85

Calls 1

atompFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…