Skip to content

Instantly share code, notes, and snippets.

@mutsune
Created October 11, 2021 23:25
Show Gist options
  • Save mutsune/2c368c1c4ffdebd06657abf0eda2b693 to your computer and use it in GitHub Desktop.
Save mutsune/2c368c1c4ffdebd06657abf0eda2b693 to your computer and use it in GitHub Desktop.
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