<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 13 September 2016 at 10:28, Brett Cannon <span dir="ltr"><<a href="mailto:brett@python.org" target="_blank">brett@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I'd like to add one more documented constraint - that dict literals maintain definition order (so long as the dict is not further modified). This allows defining a dict literal and then passing it as **kwargs.</div></div></div></div></blockquote><div><br></div></span><div>That would require all dictionaries keep their insertion order which we are explicitly not doing (at least yet). If you look at the PEPs that are asking for definition order they specify an "ordered mapping", not a dict. Making dict literals do this means dict literals become "order mapping literals" which isn't what they are; they are dict literals. I don't think we should extend this guarantee to literals any more than any other dictionary.</div></div></div></blockquote><div><br></div><div>I'm not sure I agree with you, but I'm not going to argue too strongly either (it can always be revisited later). I will note that a conforming implementation could be that the result of evaluating a dict literal is a frozen ordered dict which transparently changes to be a mutable dict as required. There could well be performance and/or memory benefits from such a dict implementation.</div><div><br></div><div>Personally I expect all Python 3.6 implementations will have order-preserving dict as that's the easiest way to achieve the existing guarantees. And that enough code will come to depend on an order-preserving dict that eventually the decision will be made to retrospectively guarantee the semantics.<br></div><div><br></div><div>Tim Delaney </div></div></div></div>