<div dir="ltr">Getting back to the original issue of being able to initialize an OrderedDict with a literal syntax, one proposal is that all dicts are ordered. There are actually several intermediate steps between dicts are unordered and ordered and here are some:<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>(1) Dict literals preserve order of the original keys. When a literal is iterated, its keys are returned in declaration order. If the dict is changed in any way, then no guarantee is made about iteration order.</div><div><br></div><div>(2) Dict literals preserve order of the original keys. This order is preserved even if values are changed as long as no keys are added or deleted. If a key is added or removed, then no guarantee is made about iteration order.</div><div><br></div><div>(3) Dict literals preserve order of the original keys. This order is preserved for all keys originally added but new keys may be returned in any order, even interspersed between original keys. The order of the new keys is not stable in that it may change anytime the dict is changed in any way.</div><div><br></div><div>(4) Dict literals are really ordered dicts.</div></blockquote><div><div><br></div><div>For the case of initialization, all of the above make <font face="monospace, monospace">OrderedDict{k1: v1, k2: v2, ...})</font> work. If that use case is the primary motivator here, then just implementing option (1) seems sufficient.</div><div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font face="arial, helvetica, sans-serif">--- Bruce<br></font><div><div><font face="arial, helvetica, sans-serif">Check out my puzzle book and g</font><span style="font-family:arial,helvetica,sans-serif;font-size:12.8px">et it free here:</span></div><div><a href="http://J.mp/ingToConclusionsFree" style="font-family:arial,helvetica,sans-serif;font-size:12.8px" target="_blank">http://J.mp/ingToConclusionsFree</a><span style="font-family:arial,helvetica,sans-serif;font-size:12.8px"> (available on iOS)</span></div></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div>
<br></div></div></div></div>