[issue24195] Add `Executor.filter` to concurrent.futures

Ram Rachum report at bugs.python.org
Mon May 18 09:30:58 CEST 2015


Ram Rachum added the comment:

Looks like this a recipe in the docs is where this ticket is headed.

I took my original example for `Executor.filter` and changed it using Brian's suggestion so now it uses `Executor.map`. Please check it out. If someone other than me feels comfortable in putting it into the documentation page, I'll be happy if you could do that.

Possible issues:

This example uses `requests`, which isn't in the standard library.

I would say that this `for` line:

        for person in (person for person, filter_result in
                       zip(people, executor.map(has_wikipedia_page, people))
                       if filter_result):

Is a bit ugly, but since the consensus here is that this is better than implementing `Executor.filter`, so be it.

----------
Added file: http://bugs.python.org/file39417/filter_example.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24195>
_______________________________________


More information about the Python-bugs-list mailing list