Futures and sequences: f_traverse
, f_sequence
, f_zip
¶
- more_executors.f_zip(*fs)¶
Create a new future holding the return values of any number of input futures.
Signature:
Future<A>[, Future<B>[, ...]] ⟶ Future<A[, B[, ...]]>
- Parameters
fs (Future) – Any number of futures.
- Returns
Note
This function is tested with up to 100,000 input futures. Exceeding this limit may result in performance issues.
New in version 1.19.0.
- more_executors.f_sequence(futures)¶
Transform a list of futures into a future containing a list.
Signature:
list<Future<X>> ⟶ Future<list<X>>
- Parameters
futures (iterable of
Future
) – A list or other iterable of futures.- Returns
Note
This function is tested with up to 100,000 input futures. Exceeding this limit may result in performance issues.
New in version 1.19.0.
- more_executors.f_traverse(fn, xs)¶
Traverse over an iterable calling a future-returning function, and return a future holding the returned values as a list.
Signature:
fn<A⟶Future<B>>, iterable<A> ⟶ Future<list<B>>
- Parameters
fn (callable) – A unary function returning a future.
xs (iterable) – An iterable to be traversed.
- Returns
New in version 1.19.0.