+1 vote
by
So I have a function like this:

import time

def f(a):
if(a>1):
time.sleep(3600)

f()
#код выполняется дальше
The function I gave as an example of a function that is very long. How to call a function and not wait for the end of the process? I would like to hear the short answer, not a recommendation of the form "Read a three-volume, Lutz and all will understand"

1 Answer

0 votes
by
 
Best answer
https://docs.python.org/3/library/threading.html
Just bear in mind that Python has a global lock, and this paralleling is very conditional.
In General, all depends on tasks. If you write something to the network, it is best to take tornado /asyncio or celery
...