-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
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
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir