Creating futures from values: f_return*

more_executors.f_return(x=None)

Return a future which provides the value x.

Signature: A Future<A>

Parameters

x – A value to be returned

Returns

Future of x

A future immediately resolved with the value x.

New in version 1.19.0.

Changed in version 2.1.0: value now defaults to None

more_executors.f_return_error(x, traceback=None)

Return a future which returns/raises the exception x.

Parameters
  • x (Exception) – An exception to be returned/raised.

  • traceback (traceback) –

    An optional traceback associated with the exception.

    This argument should only be provided on Python 2.x. It will be used in the value returned from concurrent.futures.Future.exception_info(), which only exists on Python 2.

Returns

Future of x

A future immediately resolved with the exception x.

New in version 1.19.0.

more_executors.f_return_cancelled()
Returns

Future

A future which is cancelled.

New in version 1.19.0.