This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use |yield from| in stdlib
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nobody Nosy List: asvetlov, berker.peksag, brett.cannon, jcea, nobody, python-dev, r.david.murray, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2012-10-03 16:18 by berker.peksag, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
yield-from_v1.diff berker.peksag, 2012-10-03 16:18 review
more-yield-from.diff berker.peksag, 2012-10-07 20:12 review
Messages (11)
msg171894 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2012-10-03 16:18
Related changesets:

- http://hg.python.org/cpython/rev/33a221662f39
- http://hg.python.org/cpython/rev/fb90e2ff95b7
msg171895 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012-10-03 16:25
3.3 is in bugfix mode only now. So, targeting 3.4.

I am neutral to this change. Showing use of new language idioms is nice, but merging patches to 3.3 and 3.4 would be more difficult.
msg171896 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-10-03 16:39
Thanks for the patch.

I think that seeing as we've already done a bunch, there's little reason not to do more.
msg171912 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012-10-03 22:18
Berker, could you possibly submit a Contributor Agreement Form? Details at http://www.python.org/psf/contrib/

Does your patch take care of all "yield" in the stdlib?
msg171954 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-10-04 14:28
How are people finding these uses? Grepping around for yield and seeing if it is in a 'for' loop? Or are people doing something more detailed like an AST walk of every module in the stdlib looking for some pattern?
msg171976 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-10-04 17:08
Personally I ran the following command:

  find -type f -name '*.py' -exec egrep -n -A1 '\bfor\b.*\bin\b' '{}' + | egrep -v 'yield +from' | egrep -B1 'yield +\w+(, *\w+)* *(#|$)'

I deliberately missed tests and lib2to3, because that's where the changes required more attention. Berker Peksag found a few missed, these changes LGTM.
msg172197 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-06 14:11
New changeset 7d8868c13b95 by Andrew Svetlov in branch 'default':
Issue #16120: Use |yield from| in stdlib.
http://hg.python.org/cpython/rev/7d8868c13b95
msg172198 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-10-06 14:17
Thanks, Berker.
msg172339 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2012-10-07 20:12
> Berker, could you possibly submit a Contributor Agreement Form?
> Details at http://www.python.org/psf/contrib/

Jesús, I just emailed the contributor agreement.

> Does your patch take care of all "yield" in the stdlib?

I found another one -- thanks to Serhiy's command. Patch attached.
msg172340 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-07 20:21
New changeset 70d49694786c by Andrew Svetlov in branch 'default':
Issue #16120: Use |yield from| in stdlib.
http://hg.python.org/cpython/rev/70d49694786c
msg172341 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-10-07 20:26
Fixed, thanks.
Interesting, I didn't thought «yield from» can be applied to just list, not generator. But it works.
History
Date User Action Args
2022-04-11 14:57:36adminsetgithub: 60324
2012-10-07 20:31:25vstinnersetnosy: + vstinner
2012-10-07 20:26:27asvetlovsetmessages: + msg172341
2012-10-07 20:21:25python-devsetmessages: + msg172340
2012-10-07 20:12:05berker.peksagsetfiles: + more-yield-from.diff

messages: + msg172339
2012-10-06 14:17:57asvetlovsetstatus: open -> closed

assignee: nobody

nosy: + asvetlov, nobody
messages: + msg172198
resolution: fixed
stage: resolved
2012-10-06 14:11:56python-devsetnosy: + python-dev
messages: + msg172197
2012-10-04 17:08:52serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg171976
2012-10-04 14:28:55brett.cannonsetnosy: + brett.cannon
messages: + msg171954
2012-10-03 22:18:46jceasetmessages: + msg171912
2012-10-03 16:39:03r.david.murraysetnosy: + r.david.murray
messages: + msg171896
2012-10-03 16:25:03jceasetnosy: + jcea

messages: + msg171895
versions: - Python 3.3
2012-10-03 16:18:18berker.peksagcreate