Skip to content

list.pop(index) and list[:slice:] = ...#460

Merged
antocuni merged 10 commits into
mainfrom
list-improvements
Apr 8, 2026
Merged

list.pop(index) and list[:slice:] = ...#460
antocuni merged 10 commits into
mainfrom
list-improvements

Conversation

@antocuni
Copy link
Copy Markdown
Member

@antocuni antocuni commented Apr 8, 2026

  • Add support for list.pop(i)
  • Add support for list[x] = y where x is a slice

antocuni and others added 10 commits April 8, 2026 22:01
Implement list.__setitem__(slice) with full support for step=1
(same size, grow, shrink) and extended slices (step != 1).
First test covers same-size replacement: lst[1:3] = [10, 20].

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lst[1:2] = [10, 20, 30] - replacement longer than slice.
Already passes with existing implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lst[1:4] = [10] - replacement shorter than slice.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lst[1:3] = [] - assign empty list to delete elements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lst[1:1] = [10, 20] - insert without removing.
Fixed bug where s.indices() was called with slice_len instead of
ll.length, causing wrong start position for empty slices.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lst[::2] = [10, 20, 30] with matching size, raises ValueError on
mismatched size.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antocuni antocuni merged commit 1c1d438 into main Apr 8, 2026
3 checks passed
@antocuni antocuni deleted the list-improvements branch April 8, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant