Skip to content

bpo-23677: Mention dict and set comprehension in stdtypes - #20027

Closed
furkanonder wants to merge 8 commits into
python:mainfrom
furkanonder:bpo-23677
Closed

bpo-23677: Mention dict and set comprehension in stdtypes#20027
furkanonder wants to merge 8 commits into
python:mainfrom
furkanonder:bpo-23677

Conversation

@furkanonder

@furkanonder furkanonder commented May 10, 2020

Copy link
Copy Markdown
Contributor

Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
@bedevere-bot

Copy link
Copy Markdown

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. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@furkanonder
furkanonder requested a review from rhettinger May 12, 2020 23:59
@furkanonder

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@rhettinger: please review the changes made to this pull request.

Comment thread Doc/library/stdtypes.rst
Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
Comment thread Doc/library/stdtypes.rst Outdated
rhettinger and others added 2 commits January 2, 2022 13:31
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Comment thread Doc/library/stdtypes.rst
Comment on lines +4109 to +4112
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment thread Doc/library/stdtypes.rst
Comment on lines +4308 to +4310
'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)``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'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

@rhettinger

Copy link
Copy Markdown
Contributor

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 rhettinger closed this Apr 18, 2022
@JelleZijlstra

Copy link
Copy Markdown
Member

@rhettinger the changes in this PR that talk about sets are in a section about sets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants