Skip to content

Clarify clamping specifications for sequence.insert #143420

@yousef-fadli

Description

@yousef-fadli

https://docs.python.org/3.14/library/array.html#array.array.insert

The documentation for array.array.insert(i, x) does not specify what happens
when i is greater than the length of the array.
for example :

import array

my_array = array.array("i", [1, 2, 3])
my_array.insert(10**9, 4)
print(my_array)

clarifying this behavior in the documentation improves consistency and removes ambiguity

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions