Totally agree with @prynka.chatterjee, and just to add on to that, if you’re looking to iterate lazily over key-value pairs in Python 3, you should simply use .items(). The nice thing about it in Python 3 is that it’s now more efficient because it returns an iterator, so you don’t have to explicitly use iteritems() like we did in Python 2. Here’s how I usually do it:
for key, value in dict.items():
print(key, value)
This way, Python 3 does all the heavy lifting under the hood and you get that lazy iteration, which can be a big performance win when working with larger datasets. So, the takeaway here: just use .items() in Python 3—no need for iteritems() Python 3 isn’t missing anything!