Today __getitem__ only accepts integers; gbuf[1:3] raises TypeError: index must be int. Pythonic users will expect slicing to work.
Suggested behavior: a slice returns a list[tuple[GlyphInfo, GlyphPosition]] (matches what list(gbuf)[1:3] already produces, just without materializing the full buffer).
Implementation: extend __getitem__ in src/glyph.rs to accept Bound<'_, PyAny> and dispatch on PySlice vs int. Use slice.indices(len) to normalize.
Out-of-scope items it does NOT need to support: assignment (gbuf[i] = ...), step != 1 (can support trivially), negative-step slices.
Today
__getitem__only accepts integers;gbuf[1:3]raisesTypeError: index must be int. Pythonic users will expect slicing to work.Suggested behavior: a slice returns a
list[tuple[GlyphInfo, GlyphPosition]](matches whatlist(gbuf)[1:3]already produces, just without materializing the full buffer).Implementation: extend
__getitem__insrc/glyph.rsto acceptBound<'_, PyAny>and dispatch onPySlicevs int. Useslice.indices(len)to normalize.Out-of-scope items it does NOT need to support: assignment (
gbuf[i] = ...), step != 1 (can support trivially), negative-step slices.