8000 `itertools.rst` says that `start` is a required argument for `count`, while it is not · Issue #111343 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

itertools.rst says that start is a required argument for count, while it is not #111343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sobolevn opened this issue Oct 26, 2023 · 5 comments
Closed
Assignees
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member
sobolevn commented Oct 26, 2023

Bug report

Снимок экрана 2023-10-26 в 10 04 40

However,

>>> import itertools
>>> itertools.count()
count(0)
>>> next(itertools.count())
0

I propose that we use [start, step] instead.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error docs Documentation in the Doc dir labels Oct 26, 2023
@sobolevn sobolevn self-assigned this Oct 26, 2023
sobolevn added a commit to sobolevn/cpython that referenced this issue Oct 26, 2023
@zware
Copy link
Member
zware commented Oct 26, 2023

Ideally we'd use the more accurate start=0, step=1, but I'm not sure that really fits the format of the table.

@sobolevn
Copy link
Member Author
sobolevn commented Oct 26, 2023

[start, step] might also look like a list with two items for some users 🤔

@zware
Copy link
Member
zware commented Oct 26, 2023

[start[, step]] implies that step can only be specified in conjunction with start, which also isn't true.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 27, 2023
…ount` (pythongh-111344)

(cherry picked from commit ee2d22f)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@rhettinger rhettinger closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2023
@rhettinger rhettinger reopened this Oct 27, 2023
@AlexWaygood AlexWaygood changed the title itertool.rst says that start is the required argument for count, while it is not itertools.rst says that start is the required argument for count, while it is not Oct 27, 2023
@AlexWaygood AlexWaygood changed the title itertools.rst says that start is the required argument for count, while it is not itertools.rst says that start is a required argument for count, while it is not Oct 27, 2023
@zware
Copy link
Member
zware commented Oct 30, 2023

@rhettinger, I don't think this is complete:

  1. Behavior is the same between 3.12 and 3.11, any documentation change here should be 8000 backported to at least 3.11
  2. As stated above, [start[, step]] implies that step can only be specified in conjunction with start, which also isn't true. If you really want to stick with brackets you could try something like [start[, ]][step], but really that's just getting ridiculous. start=0, step=1 is accurate and unambiguous.

@zware zware reopened this Oct 30, 2023
@rhettinger
Copy link
Contributor
rhettinger commented Nov 3, 2023

My personal opinion is that this is over nitpicking what is supposed to be an overview table with a hotlink to more details. No actual user has ever been confused by this. I accepted the PR mainly to satisty sobolevn and this isn't worth backporting or further mangling the table, As zware noted, this is getting ridiculous. The table isn't the spec intended to cover exact argument semantics. I think we're losing sight of the actual purpose are getting lost in irrelevant details in a place that wasn't intended to be awash in details.

@sobolevn sobolevn closed this as completed Nov 3, 2023
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants
0