Lets say I have a function:
from time import sleep def doSomethingThatTakesALongTime(number): print number sleep(10) and then I call it in a for loop
for number in range(10): doSomethingThatTakesALongTime(number) How can I set this up so that it only takes 10 seconds TOTAL to print out:
$ 0123456789 Instead of taking 100 seconds. If it helps, I'm going to use the information YOU provide to do asynchronous web scraping. i.e. I have a list of sites I want to visit, but I want to visit them simultaneously, rather than wait for each one to complete.