<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">On Dec 15, 2017 10:50, "Tim Peters" <<a href="mailto:tim.peters@gmail.com" target="_blank">tim.peters@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_18315112756576339quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[Eric Snow <<a href="mailto:ericsnowcurrently@gmail.com" target="_blank">ericsnowcurrently@gmail.com</a>>]<br>
<div class="m_18315112756576339quoted-text">> Does that include preserving order after deletion?<br>
<br>
</div>Given that we're blessing current behavior:<br>
<br>
- At any moment, iteration order is from oldest to newest.  So, "yes"<br>
to your question.<br>
<br>
- While iteration starts with the oldest, .popitem() returns the<br>
youngest.  This is analogous to how lists work, viewing a dict<br>
similarly ordered "left to right" (iteration starts at the left,<br>
.pop() at the right, for lists and dicts).<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Fortunately, this also matches OrderedDict.popitem().</div><div dir="auto"><br></div><div dir="auto">It'd be nice if we could also support dict.popitem(last=False) to get the other behavior, again matching OrderedDict.</div><div dir="auto"><br></div><div dir="auto">-n</div></div>