FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add a prepend() recipe to teach a chain() idiom by rhettinger · Pull Request #6415 · python/cpython · GitHub

Repository navigation

Add a prepend() recipe to teach a chain() idiom - #6415

Merged
rhettinger merged 2 commits into
python:masterfrom
rhettinger:itertools-prepend-recipe
Apr 8, 2018
Merged

rhettinger merged 2 commits into
python:masterfrom
rhettinger:itertools-prepend-recipe

Conversation

Copy link
Copy Markdown
Contributor

Comment thread Doc/library/itertools.rst Outdated
"Prepend a single value in front of an iterator"
# prepend(1, [2, 3, 4]) -> 1 2 3 4
return chain([value], iterator)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Trailing spaces.

Comment thread Doc/library/itertools.rst
def prepend(value, iterator):
"Prepend a single value in front of an iterator"
# prepend(1, [2, 3, 4]) -> 1 2 3 4
return chain([value], iterator)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A tuple would be a tiny bit faster, but look more obscure.

serhiy-storchaka removed their assignment Apr 8, 2018
rhettinger merged commit 9265dd7 into python:master Apr 8, 2018

Copy link
Copy Markdown
Contributor

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

Copy link
Copy Markdown

GH-6421 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 8, 2018
(cherry picked from commit 9265dd7)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 8, 2018
(cherry picked from commit 9265dd7)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>

Copy link
Copy Markdown

GH-6422 is a backport of this pull request to the 3.6 branch.

rhettinger added a commit that referenced this pull request Apr 8, 2018
(cherry picked from commit 9265dd7)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
rhettinger added a commit that referenced this pull request Apr 8, 2018
(cherry picked from commit 9265dd7)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
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

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL