Re: [Python-ideas] Extension of python/json syntax to support explicitly sets and ordered dict.

IIRC in CPython 3.6 and PyPy dicts are ordered based on insertion anyway; although it's an implementation-specific detail, realistically it removes some of the use cases for ordered dictionary literals. -- Ryan (ライアン) Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone elsehttp://refi64.com On Sep 7, 2017 at 6:40 AM, <Matteo Nastasi <nastasi@alternativeoutput.it>> wrote: Hi all, few days ago I thought about a way to rapresent sets and ordered dicts using a json compatible syntax, these are my conclusions: A set could be defined as { item1, item2, item3[...] } with {,} as an empty set An ordered dict could be defined as [ item1: value1, item2: value2 ... ] with [:] ase an empty odered dict It could be used inside python code or to serialize python structures in a json-like format (pyson maybe ?). What do you think about ? Kind regards, Matteo. -- email: nastasi@alternativeoutput.it, matteo.nastasi@gmail.com web: www.alternativeoutput.it irc: #linux-mi@irc.freenode.net linkedin: http://lnkd.in/SPQG87 _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

a json-like format (pyson maybe ?). I gonna pyson is a fine idea. But don't call it extended JSON ;-) For me, the point would be to capture Python' s richer data types. But would you need an OrderedDict? As pointed out, in recent cPython ( and pypy) dicts are ordered by default, but it's not part of the language spec) And you can use ast.literal_eval as a pyson parser, so it's almost ready to use :-) -CHB What do you think about ? Kind regards, Matteo. -- email: nastasi@alternativeoutput.it, matteo.nastasi@gmail.com web: www.alternativeoutput.it irc: #linux-mi@irc.freenode.net linkedin: http://lnkd.in/SPQG87 _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

a json-like format (pyson maybe ?). I gonna pyson is a fine idea. But don't call it extended JSON ;-) For me, the point would be to capture Python' s richer data types. But would you need an OrderedDict? As pointed out, in recent cPython ( and pypy) dicts are ordered by default, but it's not part of the language spec) And you can use ast.literal_eval as a pyson parser, so it's almost ready to use :-) -CHB What do you think about ? Kind regards, Matteo. -- email: nastasi@alternativeoutput.it, matteo.nastasi@gmail.com web: www.alternativeoutput.it irc: #linux-mi@irc.freenode.net linkedin: http://lnkd.in/SPQG87 _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
participants (2)
-
Chris Barker - NOAA Federal
-
rymg19@gmail.com