In Python 3.7, dictionaries preserve insertion order. The dict()
constructor, when provided with a list of tuples, will insert the keys in order. Will curly brace notation also preserve order? That is, will the below assertion always pass?
import random
keys = [str(i) for i in range(1_000_000)]
test_dict = {key: "" for key in keys}
assert keys == list(test_dict.keys())
I know this seems small, but I'm looking for specific documentation about the curly brace delimiter.
Thanks!