enumerate creates an iterator . An iterator is a python object that knows only about the current element of the sequence and how to get the next, but there is no way to restart it. Therefore, once you used an iterator in a loop, it cannot give you more elements and seems empty.
If you want to create a real sequence from an iterator, you can call list on it.
stuff = range(5,0,-1) it = enumerate(stuff) print dict(it), dict(it)
source share