Skip to content

Commit c95e6e4

Browse files
committed
json: Remove OrderdDict usage in examples.
1 parent 2812d3d commit c95e6e4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Lib/json/__init__.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
Compact encoding::
2929
3030
>>> import json
31-
>>> from collections import OrderedDict
32-
>>> mydict = OrderedDict([('4', 5), ('6', 7)])
31+
>>> mydict = {'4': 5, '6': 7}
3332
>>> json.dumps([1,2,3,mydict], separators=(',', ':'))
3433
'[1,2,3,{"4":5,"6":7}]'
3534
@@ -286,9 +285,8 @@ def load(fp, *, cls=None, object_hook=None, parse_float=None,
286285
result of any object literal decoded with an ordered list of pairs. The
287286
return value of ``object_pairs_hook`` will be used instead of the ``dict``.
288287
This feature can be used to implement custom decoders that rely on the
289-
order that the key and value pairs are decoded (for example,
290-
collections.OrderedDict will remember the order of insertion). If
291-
``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.
288+
order that the key and value pairs are decoded. If ``object_hook`` is also
289+
defined, the ``object_pairs_hook`` takes priority.
292290
293291
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
294292
kwarg; otherwise ``JSONDecoder`` is used.
@@ -314,9 +312,8 @@ def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None,
314312
result of any object literal decoded with an ordered list of pairs. The
315313
return value of ``object_pairs_hook`` will be used instead of the ``dict``.
316314
This feature can be used to implement custom decoders that rely on the
317-
order that the key and value pairs are decoded (for example,
318-
collections.OrderedDict will remember the order of insertion). If
319-
``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.
315+
order that the key and value pairs are decoded. If ``object_hook`` is also
316+
defined, the ``object_pairs_hook`` takes priority.
320317
321318
``parse_float``, if specified, will be called with the string
322319
of every JSON float to be decoded. By default this is equivalent to

0 commit comments

Comments
 (0)