Skip to content

Addition in list indexing related to negative stepΒ #782

@linnabraham

Description

@linnabraham

In https://lectures.scientific-python.org/intro/language/basic_types.html#lists it is mentioned that all slicing parameters are optional. And a few examples are shown to demonstrate what values are implicitly set when you skip these.

However the examples miss a case with negative step value. With a negative step value, the start is implicitly set to -1. Which differs from positive step value cases, where if the start is skipped, the start index is implicitly set to 0.

Although negative step is demonstrated later on, it is just with regarding to reversing a list. This aspect is not made clear there.
Maybe this can also be a warning or something.?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions