Skip to content

Commit 99b291c

Browse files
committed
Complete the documentation
1 parent fca2e5b commit 99b291c

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

Doc/c-api/dict.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ Frozen Dictionary Objects
536536
Return a new frozendict from an iterable, or ``NULL`` on failure with an
537537
exception set.
538538
539+
Create an empty dictionary if *iterable* is ``NULL``.
540+
539541
540542
Ordered Dictionaries
541543
^^^^^^^^^^^^^^^^^^^^

Doc/library/stdtypes.rst

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5588,20 +5588,10 @@ can be used interchangeably to index the same dictionary entry.
55885588
.. versionchanged:: 3.8
55895589
Dictionaries are now reversible.
55905590

5591-
.. class:: frozendict(**kwargs)
5592-
frozendict(mapping, /, **kwargs)
5593-
frozendict(iterable, /, **kwargs)
5594-
5595-
Return a new frozen dictionary initialized from an optional positional
5596-
argument and a possibly empty set of keyword arguments.
5597-
5598-
.. versionadded:: next
5599-
5600-
5601-
.. seealso::
5602-
:class:`types.MappingProxyType` can be used to create a read-only view
5603-
of a :class:`dict`.
56045591

5592+
.. seealso::
5593+
:class:`types.MappingProxyType` can be used to create a read-only view
5594+
of a :class:`dict`.
56055595

56065596
.. _thread-safety-dict:
56075597

@@ -5849,6 +5839,35 @@ An example of dictionary view usage::
58495839
500
58505840

58515841

5842+
.. class:: frozendict(**kwargs)
5843+
frozendict(mapping, /, **kwargs)
5844+
frozendict(iterable, /, **kwargs)
5845+
5846+
Return a new frozen dictionary initialized from an optional positional
5847+
argument and a possibly empty set of keyword arguments.
5848+
5849+
A frozendict has a similar API than the :class:`dict` API, with the
5850+
following differences:
5851+
5852+
* :class:`dict` has more methods than :class:`frozendict`:
5853+
5854+
* :meth:`~dict.__delitem__`
5855+
* :meth:`~dict.__setitem__`
5856+
* :meth:`~dict.clear`
5857+
* :meth:`~dict.pop`
5858+
* :meth:`~dict.popitem`
5859+
* :meth:`~dict.setdefault`
5860+
* :meth:`~dict.update`
5861+
5862+
* A frozendict can be hashed with ``hash(frozendict)`` if all keys and
5863+
values can be hashed.
5864+
5865+
* ``frozendict |= other`` does not modify the frozendict in-place but
5866+
creates a new frozen dictionary.
5867+
5868+
.. versionadded:: next
5869+
5870+
58525871
.. _typecontextmanager:
58535872

58545873
Context Manager Types

0 commit comments

Comments
 (0)