A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-March/098312.html below:

[Python-Dev] [PEP 3148] futures - execute computations asynchronously

[Python-Dev] [PEP 3148] futures - execute computations asynchronously [Python-Dev] [PEP 3148] futures - execute computations asynchronouslyGreg Ewing greg.ewing at canterbury.ac.nz
Mon Mar 8 22:39:14 CET 2010
Terry Reedy wrote:
> Looking more close, I gather that the prime 
> results will be printed 'in order' (waiting on each even if others are 
> done) while the url results will be printed 'as available'.

Seems to me that if you care about the order of the results,
you should be able to just wait for each result separately
in the order you want them. Something like

   task1 = start_task(proc1)
   task2 = start_task(proc2)
   task3 = start_task(proc3)
   result1 = task1.wait_for_result()
   result2 = task2.wait_for_result()
   result3 = task3.wait_for_result()

This would also be a natural way to write things even if
you don't care about the order, but you need all the results
before proceeding. You're going to be held up until the
longest-running task completes anyway, so it doesn't matter
if some of them finish earlier and have to sit around
waiting for you to collect the result.

-- 
Greg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4