Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use |yield from| in stdlib #60324

Closed
berkerpeksag opened this issue Oct 3, 2012 · 11 comments
Closed

Use |yield from| in stdlib #60324

berkerpeksag opened this issue Oct 3, 2012 · 11 comments
Labels
stdlib Python modules in the Lib dir

Comments

@berkerpeksag
Copy link
Member

BPO 16120
Nosy @brettcannon, @jcea, @vstinner, @bitdancer, @asvetlov, @berkerpeksag, @serhiy-storchaka
Files
  • yield-from_v1.diff
  • more-yield-from.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-10-06.14:17:57.401>
    created_at = <Date 2012-10-03.16:18:18.936>
    labels = ['library']
    title = 'Use |yield from| in stdlib'
    updated_at = <Date 2012-10-07.20:31:25.363>
    user = 'https://github.com/berkerpeksag'

    bugs.python.org fields:

    activity = <Date 2012-10-07.20:31:25.363>
    actor = 'vstinner'
    assignee = 'nobody'
    closed = True
    closed_date = <Date 2012-10-06.14:17:57.401>
    closer = 'asvetlov'
    components = ['Library (Lib)']
    creation = <Date 2012-10-03.16:18:18.936>
    creator = 'berker.peksag'
    dependencies = []
    files = ['27403', '27478']
    hgrepos = []
    issue_num = 16120
    keywords = ['patch']
    message_count = 11.0
    messages = ['171894', '171895', '171896', '171912', '171954', '171976', '172197', '172198', '172339', '172340', '172341']
    nosy_count = 9.0
    nosy_names = ['nobody', 'brett.cannon', 'jcea', 'vstinner', 'r.david.murray', 'asvetlov', 'python-dev', 'berker.peksag', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue16120'
    versions = ['Python 3.4']

    @berkerpeksag
    Copy link
    Member Author

    @berkerpeksag berkerpeksag added the stdlib Python modules in the Lib dir label Oct 3, 2012
    @jcea
    Copy link
    Member

    jcea commented Oct 3, 2012

    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.

    @bitdancer
    Copy link
    Member

    Thanks for the patch.

    I think that seeing as we've already done a bunch, there's little reason not to do more.

    @jcea
    Copy link
    Member

    jcea commented Oct 3, 2012

    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?

    @brettcannon
    Copy link
    Member

    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?

    @serhiy-storchaka
    Copy link
    Member

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 6, 2012

    New changeset 7d8868c13b95 by Andrew Svetlov in branch 'default':
    Issue bpo-16120: Use |yield from| in stdlib.
    http://hg.python.org/cpython/rev/7d8868c13b95

    @asvetlov
    Copy link
    Contributor

    asvetlov commented Oct 6, 2012

    Thanks, Berker.

    @berkerpeksag
    Copy link
    Member Author

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 7, 2012

    New changeset 70d49694786c by Andrew Svetlov in branch 'default':
    Issue bpo-16120: Use |yield from| in stdlib.
    http://hg.python.org/cpython/rev/70d49694786c

    @asvetlov
    Copy link
    Contributor

    asvetlov commented Oct 7, 2012

    Fixed, thanks.
    Interesting, I didn't thought «yield from» can be applied to just list, not generator. But it works.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    6 participants