Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13200 > unrolled thread

Re: What do you guys think about adding a method "to_json"

Started byTerry Reedy <tjreedy@udel.edu>
First post2011-09-12 17:04 -0400
Last post2011-09-12 17:04 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: What do you guys think about adding a method "to_json" Terry Reedy <tjreedy@udel.edu> - 2011-09-12 17:04 -0400

#13200 — Re: What do you guys think about adding a method "to_json"

FromTerry Reedy <tjreedy@udel.edu>
Date2011-09-12 17:04 -0400
SubjectRe: What do you guys think about adding a method "to_json"
Message-ID<mailman.1049.1315861509.27778.python-list@python.org>
On 9/12/2011 12:34 AM, Juan Pablo Romero Méndez wrote:
> Hello,
>
> What do you guys think about adding a method "to_json" to dictionaries
> and sequence types? Perhaps through a module import?

Negative. If this were added, why not to_yaml, to_marshal, to_pickle, 
to_zip, and so on. Better to have each storage or transfer class handle 
its own instance creation. The one to_x method that every class should 
have is to_string, which is spelled __str__ and inherited from object.

-- 
Terry Jan Reedy

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web