GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Signature of slice is documented incorrectly · Issue #107755 · python/cpython

Signature of slice is documented incorrectly #107755

New issue
Copy link
New issue
Copy link
Closed
Closed
Signature of slice is documented incorrectly#107755
Copy link
Assignees
rhettinger
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir

Description

@wimglenn
wimglenn
opened on Aug 8, 2023
Issue body actions

Documentation

https://docs.python.org/3/library/functions.html#slice currently shows:

class slice(start, stop, step=1)

This was changed from slice(start, stop[, step]) in #96579. That default for step is incorrect. It's correct in a range, but in a slice it actually defaults to None:

>>> slice(1,2).step is None
True

Most code handle step=1 and step=None the same way when receiving a slice, but user defined types implementing __getitem__/__setitem__/__delitem__ aren't obliged to, and the correct default should be documented.

Linked PRs

  • gh-107755: Document the correct default value of slice step #107756
  • [3.12] gh-107755: Document the correct default value of slice step (GH-107756) #108955
  • [3.11] gh-107755: Document the correct default value of slice step (GH-107756) #108956

Activity

  1. wimglenn
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Aug 8, 2023
  2. wimglenn
    added a commit that references this issue on Aug 8, 2023

    Document the correct default value of slice step. Closes python#107755

    d0d5d0a
  3. rhettinger
    self-assigned this
    on Aug 13, 2023
  4. wimglenn
    added a commit that references this issue on Aug 15, 2023

    Document the correct default value of slice step. Closes python#107755

    c9098a1
  5. encukou
    added a commit that references this issue on Sep 5, 2023

    gh-107755: Document the correct default value of slice step (GH-107756)

    9bf350b
  6. miss-islington
    added 2 commits that reference this issue on Sep 5, 2023

    pythongh-107755: Document the correct default value of slice step (py…

    c056ba4

    pythongh-107755: Document the correct default value of slice step (py…

    b36cb9e
  7. vstinner
    added a commit that references this issue on Sep 7, 2023

    [3.11] gh-107755: Document the correct default value of slice step (G…

    1f115a8
  8. Yhg1s
    added a commit that references this issue on Sep 8, 2023

    [3.12] gh-107755: Document the correct default value of slice step (G…

    eeaae92
  9. wimglenn
    closed this as completedon Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rhettinger
    rhettinger

Labels

docsDocumentation in the Doc dirDocumentation in the Doc dir

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.