| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| "Prepend a single value in front of an iterator" | ||
| # prepend(1, [2, 3, 4]) -> 1 2 3 4 | ||
| return chain([value], iterator) | ||
|
|
There was a problem hiding this comment.
Trailing spaces.
Sorry, something went wrong.
| 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) |
There was a problem hiding this comment.
A tuple would be a tiny bit faster, but look more obscure.
Sorry, something went wrong.
|
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
Sorry, something went wrong.
|
GH-6421 is a backport of this pull request to the 3.7 branch. |
Sorry, something went wrong.
(cherry picked from commit 9265dd7) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
(cherry picked from commit 9265dd7) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
|
GH-6422 is a backport of this pull request to the 3.6 branch. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
See discussion at: https://mail.python.org/pipermail/python-ideas/2018-April/049652.html