Skip to content

Instantly share code, notes, and snippets.

@agusrichard
Created January 23, 2021 16:17
Show Gist options
  • Save agusrichard/64fefafe1a8ae4069da77feb0c969fd4 to your computer and use it in GitHub Desktop.
Save agusrichard/64fefafe1a8ae4069da77feb0c969fd4 to your computer and use it in GitHub Desktop.
def do_ten_times(func):
"""Repeats func ten times"""
def wrapper():
for i in range(10):
func()
return wrapper
@do_ten_times
def say_hi():
print("Hiiiii....")
# Returns
# Hiiiii....
# Hiiiii....
# Hiiiii....
# Hiiiii....
# Hiiiii....
# Hiiiii....
# Hiiiii....
# Hiiiii....
# Hiiiii....
# Hiiiii....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment