Title: Signature of slice is documented incorrectly · Issue #107755 · python/cpython · GitHub
Open Graph Title: Signature of slice is documented incorrectly · Issue #107755 · python/cpython
X Title: Signature of slice is documented incorrectly · Issue #107755 · python/cpython
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 rang...
Open Graph 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 s...
X 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 s...
Opengraph URL: https://github.com/python/cpython/issues/107755
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Signature of slice is documented incorrectly","articleBody":"# Documentation\r\n\r\nhttps://docs.python.org/3/library/functions.html#slice currently shows:\r\n\r\n class slice(start, stop, step=1)\r\n\r\nThis was changed from `slice(start, stop[, step])` in https://github.com/python/cpython/pull/96579. That default for `step` is incorrect. It's correct in a range, but in a slice it actually defaults to `None`:\r\n\r\n \u003e\u003e\u003e slice(1,2).step is None\r\n True\r\n\r\nMost 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.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-107756\n* gh-108955\n* gh-108956\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/wimglenn","@type":"Person","name":"wimglenn"},"datePublished":"2023-08-08T01:13:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/107755/cpython/issues/107755"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b34f3370-b8d7-7ff5-4048-af8ae65291c8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C98:13C54:3DDE32C:57B8E0E:6A4FAE3A |
| html-safe-nonce | aeeef0a2f72d570b1a45b9ebd56cd307ada3540e06fbb46e5f09e499bb297d1d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Qzk4OjEzQzU0OjNEREUzMkM6NTdCOEUwRTo2QTRGQUUzQSIsInZpc2l0b3JfaWQiOiIxNDAyNjkwMzYwMjEyMTcyMzQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8ac592cd139defcb0cecdfd82e153c9ee605d553b54494564ae1b6a20bddcfb9 |
| hovercard-subject-tag | issue:1840408225 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/107755/issue_layout |
| twitter:image | https://opengraph.githubassets.com/22dbb2140592c3e504a5a584a3109855dc9a258638b282d0d712d471f05c77fb/python/cpython/issues/107755 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/22dbb2140592c3e504a5a584a3109855dc9a258638b282d0d712d471f05c77fb/python/cpython/issues/107755 |
| og:image:alt | 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 s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wimglenn |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width