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

Mislabeling of a dict comprehension as a generator expression in the tutorial #76903

Closed
Soothsayer mannequin opened this issue Jan 30, 2018 · 6 comments
Closed

Mislabeling of a dict comprehension as a generator expression in the tutorial #76903

Soothsayer mannequin opened this issue Jan 30, 2018 · 6 comments
Labels
3.8 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@Soothsayer
Copy link
Mannequin

Soothsayer mannequin commented Jan 30, 2018

BPO 32722
Nosy @matrixise, @zhangyangyu
PRs
  • bpo-32722: Remove useless example in the Classes tutorial #5446
  • 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 2018-02-01.07:32:10.267>
    created_at = <Date 2018-01-30.05:41:01.699>
    labels = ['type-feature', '3.8', 'docs']
    title = 'Mislabeling of a dict comprehension as a generator expression in the tutorial'
    updated_at = <Date 2018-02-01.07:32:10.265>
    user = 'https://bugs.python.org/Soothsayer'

    bugs.python.org fields:

    activity = <Date 2018-02-01.07:32:10.265>
    actor = 'xiang.zhang'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2018-02-01.07:32:10.267>
    closer = 'xiang.zhang'
    components = ['Documentation']
    creation = <Date 2018-01-30.05:41:01.699>
    creator = 'Soothsayer'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32722
    keywords = ['patch']
    message_count = 6.0
    messages = ['311235', '311236', '311265', '311304', '311404', '311405']
    nosy_count = 4.0
    nosy_names = ['docs@python', 'matrixise', 'xiang.zhang', 'Soothsayer']
    pr_nums = ['5446']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32722'
    versions = ['Python 3.8']

    @Soothsayer
    Copy link
    Mannequin Author

    Soothsayer mannequin commented Jan 30, 2018

    In the Python tutorial, in "9. Classes", in "9.10 Generator expression", a list of sample generator expressions used as arguments to functions is given. However, one of the examples isn't a generator expression, it's a set comprehension.

    sine_table = {x: sin(x*pi/180) for x in range(0, 91)}

    Perhaps this used to be a call to set() and was mistakenly converted?

    @Soothsayer Soothsayer mannequin added 3.7 (EOL) end of life 3.8 only security fixes labels Jan 30, 2018
    @Soothsayer Soothsayer mannequin assigned docspython Jan 30, 2018
    @Soothsayer Soothsayer mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement and removed 3.7 (EOL) end of life 3.8 only security fixes labels Jan 30, 2018
    @Soothsayer
    Copy link
    Mannequin Author

    Soothsayer mannequin commented Jan 30, 2018

    Correction: it's a dictionary comprehension, and it did indeed used to be a call to dict() in the 2.7 documentation.

    @Soothsayer Soothsayer mannequin added the 3.7 (EOL) end of life label Jan 30, 2018
    @matrixise
    Copy link
    Member

    This example is also in 2.7
    https://docs.python.org/2.7/tutorial/classes.html#generator-expressions

    -> I add 2.7

    @brettcannon brettcannon changed the title Classes Mislabeling of a dict comprehension as a generator expression in the tutorial Jan 30, 2018
    @Soothsayer
    Copy link
    Mannequin Author

    Soothsayer mannequin commented Jan 30, 2018

    I agree that 2.7 is incorrect also, 2.7 has dict comprehensions also so there's no reason to pass a generator expression to dict().

    I add 3.4 and 3.8 because they also have the problem.

    @Soothsayer Soothsayer mannequin added the 3.8 only security fixes label Jan 30, 2018
    @zhangyangyu
    Copy link
    Member

    New changeset ab32875 by Xiang Zhang (Stéphane Wirtel) in branch 'master':
    bpo-32722: Remove useless example in the Classes tutorial (bpo-5446)
    ab32875

    @zhangyangyu
    Copy link
    Member

    I treat it as an enhancement so only merge it into 3.8. Thanks Soothsayer for the report and Stéphane for the patch!

    @zhangyangyu zhangyangyu removed the 3.7 (EOL) end of life label Feb 1, 2018
    @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
    3.8 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants