{{ message }}
Fix docstring and var name of itertools recipe - #112113
Merged
Merged
Conversation
`prepend()` works with arbitrary iterables, not only iterators. In fact, the example given uses a `list`, which is iterable, but not an iterator.
Contributor
Author
AlexWaygood
approved these changes
Nov 15, 2023
Contributor
|
While it is true that any iterable will suffice, the intent and principal use case is for prepending a value to an iterator stream. Switching the variable name to So, I'm going to leave this as-is. The code is not wrong and the choice of parameter name can be anything that is useful. For someone writing type annotations, they can and should use |
Contributor
|
After more thought, I think this edit is fine. |
rhettinger
approved these changes
Nov 22, 2023
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Nov 22, 2023
`prepend()` works with arbitrary iterables, not only iterators. In fact, the example given uses a `list`, which is iterable, but not an iterator. (cherry picked from commit 6c47eac) Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
|
GH-112310 is a backport of this pull request to the 3.12 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Nov 22, 2023
`prepend()` works with arbitrary iterables, not only iterators. In fact, the example given uses a `list`, which is iterable, but not an iterator. (cherry picked from commit 6c47eac) Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
hugovk
pushed a commit
that referenced
this pull request
Nov 22, 2023
…12311) Fix docstring and var name of itertools recipe (GH-112113) `prepend()` works with arbitrary iterables, not only iterators. In fact, the example given uses a `list`, which is iterable, but not an iterator. (cherry picked from commit 6c47eac) Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
hugovk
pushed a commit
that referenced
this pull request
Nov 22, 2023
…12310) Fix docstring and var name of itertools recipe (GH-112113) `prepend()` works with arbitrary iterables, not only iterators. In fact, the example given uses a `list`, which is iterable, but not an iterator. (cherry picked from commit 6c47eac) Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
`prepend()` works with arbitrary iterables, not only iterators. In fact, the example given uses a `list`, which is iterable, but not an iterator.
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
`prepend()` works with arbitrary iterables, not only iterators. In fact, the example given uses a `list`, which is iterable, but not an iterator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

prepend()works with arbitrary iterables, not only iterators. In fact, the example given uses alist, which is iterable, but not an iterator.Spotted by @AlexWaygood in python/typeshed#10992.
📚 Documentation preview 📚: https://cpython-previews--112113.org.readthedocs.build/