File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed
Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -193,20 +193,22 @@ It does not allow modification after creation. A ``frozendict`` is not a subclas
193193it inherits directly from ``object ``. A ``frozendict `` is hashable (i.e., ``hash(frozendict) `` works)
194194as 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
You can’t perform that action at this time.
0 commit comments