On Dec 15, 2017 10:50, "Tim Peters" <tim.pet...@gmail.com> wrote:
[Eric Snow <ericsnowcurren...@gmail.com>] > Does that include preserving order after deletion? Given that we're blessing current behavior: - At any moment, iteration order is from oldest to newest. So, "yes" to your question. - While iteration starts with the oldest, .popitem() returns the youngest. This is analogous to how lists work, viewing a dict similarly ordered "left to right" (iteration starts at the left, .pop() at the right, for lists and dicts). Fortunately, this also matches OrderedDict.popitem(). It'd be nice if we could also support dict.popitem(last=False) to get the other behavior, again matching OrderedDict. -n
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com