Is it possible to get an infinite loop in for
loop?
My guess is that there can be an infinite for loop in Python. I'd like to know this for future references.
The quintessential example of an infinite loop in Python is:
while True:
pass
To apply this to a for loop, use a generator (simplest form):
def infinity():
while True:
yield
This can be used as follows:
for _ in infinity():
pass