Issue32722
Created on 2018-01-30 05:41 by Soothsayer, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 5446 | merged | matrixise, 2018-01-30 10:29 | |
| Messages (6) | |||
|---|---|---|---|
| msg311235 - (view) | Author: (Soothsayer) | Date: 2018-01-30 05:41 | |
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?
|
|||
| msg311236 - (view) | Author: (Soothsayer) | Date: 2018-01-30 05:44 | |
Correction: it's a dictionary comprehension, and it did indeed used to be a call to dict() in the 2.7 documentation. |
|||
| msg311265 - (view) | Author: Stéphane Wirtel (matrixise) * | Date: 2018-01-30 10:37 | |
This example is also in 2.7 https://docs.python.org/2.7/tutorial/classes.html#generator-expressions -> I add 2.7 |
|||
| msg311304 - (view) | Author: (Soothsayer) | Date: 2018-01-30 23:18 | |
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. |
|||
| msg311404 - (view) | Author: Xiang Zhang (xiang.zhang) * | Date: 2018-02-01 07:31 | |
New changeset ab328756d7fd969ee4882458b07892dff135013c by Xiang Zhang (Stéphane Wirtel) in branch 'master': bpo-32722: Remove useless example in the Classes tutorial (#5446) https://github.com/python/cpython/commit/ab328756d7fd969ee4882458b07892dff135013c |
|||
| msg311405 - (view) | Author: Xiang Zhang (xiang.zhang) * | Date: 2018-02-01 07:32 | |
I treat it as an enhancement so only merge it into 3.8. Thanks Soothsayer for the report and Stéphane for the patch! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:57 | admin | set | github: 76903 |
| 2018-02-01 07:32:10 | xiang.zhang | set | status: open -> closed versions: - Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 messages: + msg311405 resolution: fixed |
| 2018-02-01 07:31:10 | xiang.zhang | set | nosy:
+ xiang.zhang messages: + msg311404 |
| 2018-01-30 23:18:14 | Soothsayer | set | messages:
+ msg311304 versions: + Python 3.4, Python 3.8 |
| 2018-01-30 20:28:48 | brett.cannon | set | title: Classes -> Mislabeling of a dict comprehension as a generator expression in the tutorial |
| 2018-01-30 10:37:22 | matrixise | set | nosy:
+ matrixise messages:
+ msg311265 |
| 2018-01-30 10:29:51 | matrixise | set | keywords:
+ patch stage: patch review pull_requests: + pull_request5278 |
| 2018-01-30 05:44:19 | Soothsayer | set | messages:
+ msg311236 versions: + Python 3.7 |
| 2018-01-30 05:41:46 | Soothsayer | set | versions: + Python 3.5, Python 3.6, - Python 3.7, Python 3.8 |
| 2018-01-30 05:41:01 | Soothsayer | create | |