I know how to implement an async operation in Java like this
Instantiate a new thread -> thread do time-consuming stuff(disk IO or network activity) -> thread finishes its job and pass result to main thread
I'm trying to do the same thing in python but could not find a way...
I have read about async and await, multiprocessing.Pool. Neither gives me an clear idea on how to achieve the same thing.
The nearest way I found is multiprocessing.Pool.apply_async(Callable,Iterable,Callback).But this thing cannot be instantiate in a class since it needs to be wrapped in if __name__=="__main__" and the __name__ is my class name.
Any elegant way to do async in Python? Thanks!