When doing some simple scripting in python I noticed something strange. Take a look
>>> x=zip((1,2),(3,4))
>>> for i in x:
... print(x)
...
<zip object at 0x00000284D034F248>
<zip object at 0x00000284D034F248>
>>> for i in x:
... for k in i:
... print(k)
...
>>> for i in x:
... print(x)
...
>>> x=zip((1,2),(3,4))
>>> for i in x:
... for k in i:
... print(k)
1
3
2
4
When I print x in the first loop, I get 2 zip objects, as expected. But in the second look I just get nothing, then I run the first loop again and still get nothing, what happened to x?
Then as a check to make sure the second loop does actually work I redefined x and ran it. Please help me understand whats going on. Thanks