Here is a code snippet.
x = {} x[1] = len(x) print x {1: 0}
Is this well defined? That is, could x == {1: 1} instead?
x == {1: 1}
Yes, it's defined. len() is called before the assignment. However, dict's are not ordered in Python, which is why you sometimes see 0, 1 and 1, 0 in the output.
len()
dict