I am a bit confused by this paragraph in python docs for dict class
If items(), keys(), values(), iteritems(), iterkeys(), and
itervalues() are called with no intervening modifications to the
dictionary, the lists will directly correspond. This allows the
creation of (value, key) pairs using zip(): pairs = zip(d.values(),
d.keys())
what is meant by called with no intervening modifications ?
if I receive a dict instance which was spewed out by some function(I have no way of knowing if the elements were modified since the dict was created)..can I still use the zip(d.values(),d.keys()) ?
Yes.
The point is you should not modify
dbetween callingd.values()andd.keys().