Skip to content

Commit df61c65

Browse files
corona10vstinner
andauthored
Update Doc/whatsnew/3.15.rst
Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent b4f2e18 commit df61c65

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

Doc/whatsnew/3.15.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,22 @@ It does not allow modification after creation. A ``frozendict`` is not a subclas
193193
it inherits directly from ``object``. A ``frozendict`` is hashable (i.e., ``hash(frozendict)`` works)
194194
as long as all of its keys and values are hashable.
195195

196-
>>> a = frozendict(x=1, y=2)
197-
>>> a
198-
frozendict({'x': 1, 'y': 2})
199-
>>> a['z'] = 3
200-
Traceback (most recent call last):
201-
File "<python-input-2>", line 1, in <module>
202-
a['z'] = 3
203-
~^^^^^
204-
TypeError: 'frozendict' object does not support item assignment
205-
>>> b = frozendict(y=2, x=1)
206-
>>> hash(a) == hash(b)
207-
True
208-
>>> a == b
209-
True
196+
For example::
197+
198+
>>> a = frozendict(x=1, y=2)
199+
>>> a
200+
frozendict({'x': 1, 'y': 2})
201+
>>> a['z'] = 3
202+
Traceback (most recent call last):
203+
File "<python-input-2>", line 1, in <module>
204+
a['z'] = 3
205+
~^^^^^
206+
TypeError: 'frozendict' object does not support item assignment
207+
>>> b = frozendict(y=2, x=1)
208+
>>> hash(a) == hash(b)
209+
True
210+
>>> a == b
211+
True
210212

211213
.. seealso:: :pep:`814` for the full specification and rationale.
212214

0 commit comments

Comments
 (0)