[Python-Dev] Guarantee ordered dict literals in v3.7? (original) (raw)
Tim Peters tim.peters at gmail.com
Fri Dec 15 13:47:54 EST 2017
- Previous message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Next message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Eric Snow <ericsnowcurrently at 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).
- Previous message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Next message (by thread): [Python-Dev] Guarantee ordered dict literals in v3.7?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]