Skip to content

Conversation

@rhettinger
Copy link
Contributor

"Prepend a single value in front of an iterator"
# prepend(1, [2, 3, 4]) -> 1 2 3 4
return chain([value], iterator)

Copy link
Member

Choose a reason for hiding this comment

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

Trailing spaces.

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
Member

Choose a reason for hiding this comment

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

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

@serhiy-storchaka serhiy-storchaka removed their assignment Apr 8, 2018
@rhettinger rhettinger merged commit 9265dd7 into python:master Apr 8, 2018
@miss-islington
Copy link
Contributor

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

@bedevere-bot
Copy link

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 <[email protected]>
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 <[email protected]>
@bedevere-bot
Copy link

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 <[email protected]>
rhettinger added a commit that referenced this pull request Apr 8, 2018
(cherry picked from commit 9265dd7)

Co-authored-by: Raymond Hettinger <[email protected]>
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