diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-10-26 03:01:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 03:01:11 (GMT) |
commit | 0f937250631100d574c7b857c098a440b028f2b2 (patch) | |
tree | ef1881a1a718bb351a563d3205e41eeb8e4d8782 | |
parent | 866dc74afacb389077472e175d6f5cb8befc3efc (diff) | |
download | cpython-0f937250631100d574c7b857c098a440b028f2b2.zip cpython-0f937250631100d574c7b857c098a440b028f2b2.tar.gz cpython-0f937250631100d574c7b857c098a440b028f2b2.tar.bz2 |
gh-77753: Add example for values that compare equal in stdtypes (GH-98497)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 0ca6a4d64086055a8a3aa4b4c024fc080de148ab)
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
-rw-r--r-- | Doc/library/stdtypes.rst | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 868d7bb..1dbf3e2 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4330,11 +4330,9 @@ type, the :dfn:`dictionary`. (For other containers see the built-in A dictionary's keys are *almost* arbitrary values. Values that are not :term:`hashable`, that is, values containing lists, dictionaries or other mutable types (that are compared by value rather than by object identity) may -not be used as keys. Numeric types used for keys obey the normal rules for -numeric comparison: if two numbers compare equal (such as ``1`` and ``1.0``) -then they can be used interchangeably to index the same dictionary entry. (Note -however, that since computers store floating-point numbers as approximations it -is usually unwise to use them as dictionary keys.) +not be used as keys. +Values that compare equal (such as ``1``, ``1.0``, and ``True``) +can be used interchangeably to index the same dictionary entry. .. class:: dict(**kwargs) dict(mapping, **kwargs) |