[Python-ideas] Python Object Notation (PyON)

Arnaud Delobelle arnodel at googlemail.com
Wed Nov 5 11:57:24 CET 2008


On 05/11/2008, Zaur Shibzoukhov <szport at gmail.com> wrote:
> I have added support for naming objects in dumps,  cross-references
> and declarative support in dumps/loads too.

This is great stuff!

> I can't now commit changes. This night I will commit changes to
> sources and update project pages.
>
> Here are examples of how it works now:
[...]
> >>> pyon.dumps([lst,d,c], fast = False, lst=lst, d=d)

How about changing the syntax slightly so that the given names are all
in a dictionary:

>>> pyon.dumps([lst, d, c], fast=False, given={'lst':lst, 'd':d})
(or one could use given=dict(lst=lst, d=d))

This would have two advantages:

* eliminate the rist of keyword argument name collision
* one could put all the 'given' objects in a dictionary and then
'pickle' expressions as needed using this method.  Later pyon.loads
could be passed this dictionary so that the objects can be unpickled
correctly.

I think this idea is good as it would make it possible to pickle some
objects that contain unpicklable objects just by declaring them as
'given'.


Also, what happens with types? E.g.

>>> pyon.dumps([int, float, str])

I think it would be good if typenames were considered literals (like
numbers and strings) so that the above returns '[int, float, str]'
(and the same for user-defined types maybe).

-- 
Arnaud



More information about the Python-ideas mailing list