[Python-ideas] Json object-level serializer (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu Jul 29 15:34:29 CEST 2010
- Previous message: [Python-ideas] Json object-level serializer
- Next message: [Python-ideas] Json object-level serializer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 29 Jul 2010 15:25:20 +0200 Tarek Ziadé <ziade.tarek at gmail.com> wrote:
That makes sense. OTHO, if we drop the idea of having a magical method, we could have an collections' ABC instead, called JSONSerializable, with one method to override, This is more about declaring the interface rather than adding yet another magic method That's a nice OOP pattern to have imho
Python is supposed to be duck-typed. It would be strange to add a couple of random exceptions to that general rule. Moreover, having to both derive an existing class and implement the single method defined on that class is one complication too many.
And I don't see how __json__
is more annoying than e.g. to_json
.
Regards
Antoine.
- Previous message: [Python-ideas] Json object-level serializer
- Next message: [Python-ideas] Json object-level serializer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]