[Python-ideas] Python Object Notation (PyON)

Zaur Shibzoukhov szport at gmail.com
Mon Nov 3 16:36:57 CET 2008


Arnaud Delobelle wrote:

> How do you represent a recursive list? E.g.
> On 1 Nov 2008, at 19:49, Mathias Panzenböck wrote:
> >
> > I wonder what it would yield in this case:
> > lst = ['foo']
> > lst.append(lst)
Now pyon can represent recursive lists and dicts:

>>> lst = ['foo']
>>> lst.append(lst)
>>> pyon.dumps(lst, fast=False) # fast mode is similar to pickle's fast mode
_p__0=['foo',None]
_p__0[1]=_p__0
_p__0

>>> d = {'a':'foo'}
>>> d['b'] = d
>>> pyon.dumps(d, fast=False)
_p__0={'a':'foo'}
_p__0['b']=_p__0
_p__0

I will commit changes to sources this evening.

Best regards,
Zaur



More information about the Python-ideas mailing list