Skip to content

Commit

Permalink
Fix indentation in json.AttrDict REPL example (python#104930)
Browse files Browse the repository at this point in the history
This is causing the docs to be rendered incorrectly.
  • Loading branch information
AlexWaygood authored May 25, 2023
1 parent 1080c43 commit 38539ef
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Doc/library/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,14 @@ Exceptions

.. doctest::

>>> json_string = '{"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
>>> orbital_period = json.loads(json_string, object_hook=AttrDict)
>>> orbital_period['earth'] # Dict style lookup
365
>>> orbital_period.earth # Attribute style lookup
365
>>> orbital_period.keys() # All dict methods are present
dict_keys(['mercury', 'venus', 'earth', 'mars'])
>>> json_string = '{"mercury": 88, "venus": 225, "earth": 365, "mars": 687}'
>>> orbital_period = json.loads(json_string, object_hook=AttrDict)
>>> orbital_period['earth'] # Dict style lookup
365
>>> orbital_period.earth # Attribute style lookup
365
>>> orbital_period.keys() # All dict methods are present
dict_keys(['mercury', 'venus', 'earth', 'mars'])

Attribute style access only works for keys that are valid attribute
names. In contrast, dictionary style access works for all keys. For
Expand Down

0 comments on commit 38539ef

Please # to comment.