Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4106,8 +4106,10 @@ its contents cannot be altered after it is created; it can therefore be used as
a dictionary key or as an element of another set.

Non-empty sets (not frozensets) can be created by placing a comma-separated list
of elements within braces, for example: ``{'jack', 'sjoerd'}``, in addition to the
:class:`set` constructor.
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.
Comment thread
furkanonder marked this conversation as resolved.
Comment on lines +4109 to +4112

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


The constructors for both classes work the same:

Expand Down Expand Up @@ -4303,7 +4305,9 @@ is usually unwise to use them as dictionary keys.)

Dictionaries can be created by placing a comma-separated list of ``key: value``
pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
'jack', 4127: 'sjoerd'}``, or by the :class:`dict` constructor.
'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)``.
Comment on lines +4308 to +4310

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


.. class:: dict(**kwarg)
dict(mapping, **kwarg)
Expand Down