[docs] [issue16057] Subclasses of JSONEncoder should not be insturcted to call JSONEncoder.decode

Justin Lebar report at bugs.python.org
Fri Sep 28 22:23:02 CEST 2012


Justin Lebar added the comment:
Ah, I see. The examples do what you think they should do, but not for the reason you think they should do it -- the JSON encoding logic calls the encoder's encode() method before calling its default() method.
I still think the examples could be improved, perhaps by adding a comment to the effect of 
 # Raises a TypeError.
before the call to JSONEncoder.default(). Explicit is better than implicit, after all. :)
Thanks for looking at this.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16057>
_______________________________________


More information about the docs mailing list

AltStyle によって変換されたページ (->オリジナル) /