Ethan Furman added the comment: Short History: =============
(Ram Rachum) What do you think about adding a method: `Executor.filter`? I was using something like this: my_things = [thing for thing in things if some_condition(thing)] But the problem was that `some_condition` took a long time to run waiting on I/O, which is a great candidate for parallelizing with ThreadPoolExecutor. I made it work using `Executor.map` and some improvizing, but it would be nicer if I could do: with concurrent.futures.ThreadPoolExecutor(100) as executor: my_things = executor.filter(some_condition, things) And have the condition run in parallel on all the threads. (Nick Coughlan) I think this is sufficiently tricky to get right that it's worth adding filter() as a parallel to the existing map() API. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24195> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com