diff options
Diffstat (limited to 'Doc/library/json.rst')
-rw-r--r-- | Doc/library/json.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 7b69c24..58eee18 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -83,6 +83,7 @@ Extending :class:`JSONEncoder`:: ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] + ... # Let the base class default method raise the TypeError ... return json.JSONEncoder.default(self, obj) ... >>> json.dumps(2 + 1j, cls=ComplexEncoder) @@ -431,6 +432,7 @@ Encoders and Decoders pass else: return list(iterable) + # Let the base class default method raise the TypeError return json.JSONEncoder.default(self, o) |