Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 615537e

Browse filesBrowse files
authored
gh-96408: Document difference between set-like view and sets. (GH-96439)
1 parent 29f1b0b commit 615537e
Copy full SHA for 615537e

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎Doc/library/stdtypes.rst

Copy file name to clipboardExpand all lines: Doc/library/stdtypes.rst
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4694,7 +4694,9 @@ values are hashable, so that ``(key, value)`` pairs are unique and hashable,
46944694
then the items view is also set-like. (Values views are not treated as set-like
46954695
since the entries are generally not unique.) For set-like views, all of the
46964696
operations defined for the abstract base class :class:`collections.abc.Set` are
4697-
available (for example, ``==``, ``<``, or ``^``).
4697+
available (for example, ``==``, ``<``, or ``^``). While using set operators,
4698+
set-like views accept any iterable as the other operand, unlike sets which only
4699+
accept sets as the input.
46984700

46994701
An example of dictionary view usage::
47004702

@@ -4726,6 +4728,8 @@ An example of dictionary view usage::
47264728
{'bacon'}
47274729
>>> keys ^ {'sausage', 'juice'}
47284730
{'juice', 'sausage', 'bacon', 'spam'}
4731+
>>> keys | ['juice', 'juice', 'juice']
4732+
{'juice', 'sausage', 'bacon', 'spam', 'eggs'}
47294733

47304734
>>> # get back a read-only proxy for the original dictionary
47314735
>>> values.mapping

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.