Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- import time
- async def call1(x, y, z):
- await asyncio.sleep(1)
- print(x, y, z)
- def call2(x, y, z):
- time.sleep(1)
- print(x, y, z)
- def wrapper(func, *args):
- if asyncio.iscoroutinefunction(func):
- asyncio.get_event_loop().run_until_complete(func(*args))
- else:
- func(*args)
- if __name__ == '__main__':
- wrapper(call1, 1, 2, 3)
- wrapper(call2, 1, 2, 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement