Skip to content

Instantly share code, notes, and snippets.

@rec
Last active July 14, 2020 09:55
Show Gist options
  • Save rec/0a7f6cee04560769b8f1e0cd4b5588be to your computer and use it in GitHub Desktop.
Save rec/0a7f6cee04560769b8f1e0cd4b5588be to your computer and use it in GitHub Desktop.
def loops_forever(function, *arguments):
# Return True if function(*arguments) loops forever
# Let's try it out
def loops_forever():
while True:
print()
def loops_once():
running = True
while running:
running = not running
>>> print(loops_forever(loops_forever))
True
>>> print(loops_forever(loops_once))
False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment