That iterating over a dict could yield sorted keys was surprising. It would be considerably useful too, if this is a guaranteed behaviour.
example code
fruits = {3: "banana",
4: "grapes",
1: "apple",
2: "cherry"}
# Looping over the dict itelf
for each in fruits:
print each, fruits[each]
output
1 apple
2 cherry
3 banana
4 grapes
# Looping over the generator produces the same result too
for each in iter(fruits):
print each, fruits[each]
Note: I would like to point out that I don't want implement an ordered dict. I just wanted to verify if the code written above is a normal, recurring behavior in python (version 2.7 above)