[Python-ideas] Python Object Notation (PyON)
szport at gmail.com
Wed Nov 5 12:25:58 CET 2008
2008/11/5 Arnaud Delobelle wrote:
> (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
> 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
I think it's reasonable. I will change the interface.
> 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).
Yes, pyon can dump types too.
One note: default rule for name resolving uses
sys._getframe(1).f_globals and sys._getframe(1).f_locals. But you can
change name resolver writing you own.
>>> class C(object): pass
[<class 'int'>, <class 'bool'>, <class 'float'>, <class '__main__.C'>]
More information about the Python-ideas