[Python-ideas] Proposal: New syntax for OrderedDict, maybe built-in
David Wilson
dw+python-ideas at hmmz.org
Thu Sep 4 20:00:44 CEST 2014
On Thu, Sep 04, 2014 at 07:35:06PM +0200, Norman Hooper wrote:
> I work with OrderedDict a lot, because JSON represents an OrderedDict
> and I need to work with JSON a lot.
ECMAScript:
4.3.3 Object
An object is a member of the type Object. It is an unordered
collection of properties each of which contains a primitive value,
object, or function. A function stored in a property of an object is
called a method.
JSON:
1. Introduction
An object is an unordered collection of zero or more name/value
pairs, where a name is a string and a value is a string, number,
boolean, null, object, or array.
> With the ubiquity of JSON, it may also be time to promote OrderedDict
> to a built-in type too.
Neither JSON objects nor JavaScript object properties preserve
enumeration order. This is a common misconception since implementations
tend to preserve order when the number of keys is small, since they may
use a more efficient internal representation in that case, whose
enumeration order depends on order the properties were defined in.
David
More information about the Python-ideas
mailing list