summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorJan Max Meyer <jmm@phorward.de>2024-02-28 13:54:12 (GMT)
committerGitHub <noreply@github.com>2024-02-28 13:54:12 (GMT)
commit647053fed182066d3b8c934fb0bf52ee48ff3911 (patch)
tree7744fbebf95291922cc730f4fd5063da93beca2e /Doc/library
parent449c6da2bdc5c6aa5e096aa550a4ba377b85db46 (diff)
downloadcpython-647053fed182066d3b8c934fb0bf52ee48ff3911.zip
cpython-647053fed182066d3b8c934fb0bf52ee48ff3911.tar.gz
cpython-647053fed182066d3b8c934fb0bf52ee48ff3911.tar.bz2
doc: Use super() in subclassed JSONEncoder examples (GH-115565)
Replace calls to `json.JSONEncoder.default(self, obj)` by `super().default(obj)` within the examples of the documentation.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/json.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index 0ce4b69..c82ff9d 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -106,7 +106,7 @@ Extending :class:`JSONEncoder`::
... if isinstance(obj, complex):
... return [obj.real, obj.imag]
... # Let the base class default method raise the TypeError
- ... return json.JSONEncoder.default(self, obj)
+ ... return super().default(obj)
...
>>> json.dumps(2 + 1j, cls=ComplexEncoder)
'[2.0, 1.0]'
@@ -504,7 +504,7 @@ Encoders and Decoders
else:
return list(iterable)
# Let the base class default method raise the TypeError
- return json.JSONEncoder.default(self, o)
+ return super().default(o)
.. method:: encode(o)