Created
October 11, 2021 23:25
-
-
Save mutsune/2c368c1c4ffdebd06657abf0eda2b693 to your computer and use it in GitHub Desktop.
https://github.com/alex-sherman/deco usage sample
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
from deco import concurrent | |
from deco import synchronized | |
import time | |
@concurrent | |
def process(data): | |
time.sleep(1) | |
return data | |
@synchronized | |
def process_data_set(data_set): | |
result_list = [] | |
for data in data_set: | |
result_list.append(process(data)) | |
return result_list | |
def main(): | |
result = process_data_set(range(10)) | |
print(result) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment