Created
July 6, 2018 20:15
-
-
Save ferdiunal/72d4207c63ed47895ab381e0cf0de325 to your computer and use it in GitHub Desktop.
Bir işlemi belirli bir sayıda tekrar deneyin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Retry an operation a given number of times. | |
Bir işlemi belirli bir sayıda tekrar deneyin. | |
""" | |
def retry(times, callback): | |
try: | |
if not times: | |
return | |
return callback() | |
except: | |
if not times: | |
raise | |
return retry((times - 1),callback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment