Weird generator output
Using this code: def infinite_sevens(): while True: yield 7 for i in infinite_sevens(): print(i) Output: 7 7 7 7 7 7 7 7 7 (until time limit exceeded) The output is, as expected, infinite sevens (until the time limit is exceeded). However, I then modified the code a little bit, and I get a weird output that changes every time i run the program: def infinite_sevens(): while True: yield 7 print(infinite_sevens()) Output: <generator object infinite_sevens at 0x02084FB0> (I ran the program again) Output: <generator object infinite_sevens at 0x010A5130> (And again) Output: <generator object infinite_sevens at 0x027D5130> What does this output mean? Why do I get different outputs every time I run the program? Aren't the two codes basically the same? If so, why does one give an output of infinite sevens, and the other gives an output like that?