I was thinking about an extended json too, not just python syntax. What do you think about it ?
Regards and thank you for your time. Matteo. On Thu, Sep 07, 2017 at 09:54:15PM +1000, Steven D'Aprano wrote: > On Thu, Sep 07, 2017 at 01:36:31PM +0200, Matteo Nastasi wrote: > > > A set could be defined as { item1, item2, item3[...] } > > Guido's time machine strikes again. Python 3: > > py> s = {1, 2, 3} > py> type(s) > <class 'set'> > > > > with {,} as an empty set > > That looks like a typo. I don't think that having a literal for empty > sets is important enough that we need worry about the lack. > > > > An ordered dict could be defined as [ item1: value1, item2: value2 ... ] > > with [:] ase an empty odered dict > > I think that's been proposed before. > > I don't hate that suggestion, but I don't think its very useful either. > We already have a de facto "Ordered Mapping" literal that can be passed > to the OrderedDict constructor: > > OrderedDict( > [(key1, value1), (key2, value2), (key3, value3), ...] > ) > > Its not quite as compact, but it isn't too awful. And if you really > don't like it, try: > > OrderedDict(zip(keys, values)) > > > > -- > Steven > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- email: nast...@alternativeoutput.it, matteo.nast...@gmail.com web: www.alternativeoutput.it irc: #linux...@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/