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
bpo-23677: Mention dict and set comprehension in stdtypes #20027
Conversation
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @rhettinger: please review the changes made to this pull request. |
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
| of elements within braces, for example: ``{'jack', 'sjoerd'}``. Sets can | ||
| be created by using a set comprehension, for example ``{2 * x for x in iterable}``. | ||
| Also, set comprehensions can make both empty and non-empty sets. In addition to | ||
| the :class:`set` constructor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| of elements within braces, for example: ``{'jack', 'sjoerd'}``. Sets can | |
| be created by using a set comprehension, for example ``{2 * x for x in iterable}``. | |
| Also, set comprehensions can make both empty and non-empty sets. In addition to | |
| the :class:`set` constructor. | |
| of elements within braces, for example ``{'jack', 'sjoerd'}``. Sets can | |
| be created by using a :term:`set comprehension`, for example ``{2 * x for x in iterable}``, | |
| or using the :class:`set` constructor. |
- Remove unnecessary sentence about creating empty sets using a setcomp.
- Fix incomplete sentence
- Link to the glossary
| 'jack', 4127: 'sjoerd'}``, by a dict comprehension, for example: ``{x: x**2 for | ||
| x in iterable}``. Dictionaries can also be created by the :class:`dict` | ||
| constructor, for example: ``dict(jack=4098, sjoerd=4127)``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'jack', 4127: 'sjoerd'}``, by a dict comprehension, for example: ``{x: x**2 for | |
| x in iterable}``. Dictionaries can also be created by the :class:`dict` | |
| constructor, for example: ``dict(jack=4098, sjoerd=4127)``. | |
| 'jack', 4127: 'sjoerd'}``, or by a :term:`dictionary comprehension`, for example: ``{x: x**2 for | |
| x in iterable}``. Dictionaries can also be created by the :class:`dict` | |
| constructor, for example: ``dict(jack=4098, sjoerd=4127)``. |
Link the glossary term
|
Thanks for the suggestion, but I'm going to decline. This section is about set objects and it doesn't make sense to be talking about dictionary comprehensions here. We cover mention set comprehensions right at the top of the object description ( https://docs.python.org/3/library/stdtypes.html#set ). This is consistent with how we document ways to create lists ( https://docs.python.org/3/library/stdtypes.html#list ). |
|
@rhettinger the changes in this PR that talk about sets are in a section about sets. |
https://bugs.python.org/issue23677