Terry Reedy wrote:<br><br>> Other than syntax details, how is PyON different from json, yaml (3rd <br>> party module), and anything else?<br><br>I hope that PyON can be seen as native literal object notation for objects in python language. Similar to what JSON is for JavaScript ;) JavaScript hasn't classes, but python has that. So we could say that PyON in some way extends JSON. I that it's better reflecting python's object model.<br>
<br>I'l try to explain this by example. Let<br><br>class Person(object):<br><div style="margin-left: 40px;">pass<br><br></div>person = Person()<br><a href="http://person.name">person.name</a> = 'John'<br>person.age = 33<br>
<br>First, in PyON person represents as "Person(name='John', age=33)" and loads return an instance of Person.<br>In JSON we need to represent person in a way similar to "{'class':'Person', 'name':'John', 'age':33}" and loads always return dict-like structure, not instance of Person.<br>
<br>Second, object instance reconstruction from PyON string or AST performs according to picklie protocol (3). This mean that if we define class that implements right methods in accordance to pickle protocol then we can dumps to PyON string and loads from that.<br>
<br>I didn't yet made comparison with yaml. I should do that too. Now I can only say that yaml is much complicated notation (IMHO).<br><br>>>> Grammar:   <kw> := <name> = <pyon_expr>, ..., <name> = <pyon_expr><br>
>>> There is no rule for pyon_expr.  Did you just mean <expr>?<br>You right, thank you. This a tipo. I'l update the page.<br><br>> ...   y=IF(<br>> ...     flag,<br>> ...     A1(kind='A1'),<br>
> ...     A2(kind='A2')<br>> ...   )<br><br>This didn't covered by current rough gramma definition. I still do not know if this must be a part of PyON.<br>The fact is that PyON can be extended to thing such as "object template" and current implementation include some of such opportunities. One of this you pointed out here. Here is another example:<br>
       person = loads("Person(name=real_name, age=real_age)", real_name='John', real_age=33)<br><br><br>Best regards,<br>Zaur<br>