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


Groups > comp.lang.python > #15010

Re: Forking simplejson

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'json': 0.07; 'received:verizon.net': 0.07; 'terry': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'api': 0.09; ';-)': 0.12; 'am,': 0.12; 'algorithm': 0.13; 'protocol': 0.15; 'reedy': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'jan': 0.19; 'header :In-Reply-To:1': 0.22; 'breaks': 0.23; 'documented': 0.23; 'objects,': 0.23; 'priority': 0.23; 'function': 0.27; 'classes': 0.28; '(and': 0.29; '---': 0.29; 'elsewhere': 0.30; 'fork': 0.30; 'protocol.': 0.30; 'protocols': 0.30; 'class': 0.30; 'list': 0.32; 'cases': 0.32; 'objects': 0.32; 'implement': 0.32; 'to:addr :python-list': 0.33; 'instead': 0.33; 'rules': 0.34; 'header:User- Agent:1': 0.34; 'curious': 0.34; 'like:': 0.34; 'header:X -Complaints-To:1': 0.35; 'object': 0.35; 'url:python': 0.36; 'received:org': 0.38; 'url:org': 0.38; 'subject:: ': 0.39; 'url:docs': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'case': 0.39; 'where': 0.40; 'custom': 0.61; 'free': 0.63; 'plus': 0.65; 'benefit': 0.66; 'special': 0.67; '3.3': 0.84; 'url:datamodel': 0.84; 'url:reference': 0.84; 'summarized': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Forking simplejson
Date Wed, 26 Oct 2011 15:29:09 -0400
References <CAL7_Mo8cLHxh9bt1NvmJFDzLMz9K3gm9k53JRzRSKQPB1485BA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Gmane-NNTP-Posting-Host pool-74-109-121-73.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0
In-Reply-To <CAL7_Mo8cLHxh9bt1NvmJFDzLMz9K3gm9k53JRzRSKQPB1485BA@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2234.1319657367.27778.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1319657367 news.xs4all.nl 6915 [2001:888:2000:d::a6]:52348
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:15010

Show key headers only | View raw


On 10/26/2011 5:14 AM, Amirouche Boubekki wrote:
> Héllo,
>
> I would like to fork simplejson [1] and implement serialization rules
> based on protocols instead of types [2], plus special cases for protocol
> free objects, that breaks compatibility. The benefit will be a better
> API for json serialization of custom classes and in the case of iterable
> it will avoid a calls like:
>
>  >>> simplejson.dumps(list(my_iterable))
>
> The serialization of custom objects is documented in the class instead
> of the ``default`` function of current simplejson implementation [3].
>
> The encoding algorithm works with a priority list that is summarized in
> the next table:
>
> +-------------------+---------------+
> | Python protocol | JSON |
> | or special case | |
> +===================+===============+
> | (ø) __json__ | see (ø) |
> +-------------------+---------------|
>       | map               | object        |

I am curious what you mean by the 'map' protocol.

 > Where are documented the different protocols implemented by Python 
objects ?

Ref 3.3 special method names (and elsewhere ;-)
http://docs.python.org/py3k/reference/datamodel.html#special-method-names

---
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Forking simplejson Terry Reedy <tjreedy@udel.edu> - 2011-10-26 15:29 -0400

csiph-web