MRAB
[for a literal OrderedDict,] How about ['a':'1', 'b':'2', 'c':'3']?
+1. That's quite good, and has symmetry with existing syntax:: {'fred', 'barney', 4.75} # unordered set ['fred', 'barney', 4.75] # ordered list {'foo': 10.2, 'bar': 8.19} # unordered dict ['foo': 10.2, 'bar': 8.19] # ordered dict That looks good to me.
Ideally we would have [...] for ordered and {...} for unordered, with ':' if it's keyed:
[] ordered, value (list) [:] ordered, key+value (odict) {} unordered, value (set) {:} unordered, key+value (dict)
It's too late to change that in Python 3.x, so it would have to be:
[] ordered, value (list) [:] ordered, key+value (odict) {,} unordered, value (set) {} unordered, key+value (dict)
-0. Unlike syntax for creating and populating an instance, I actually don't think we need to worry about having specific syntax for empty. Compared to a non-empty container, it's quite a lower burden to simply have an explicit call to the type constructor to create an empty container. -- \ “Probably the toughest time in anyone's life is when you have | `\ to murder a loved one because they're the devil.” —Emo Philips | _o__) | Ben Finney