Unpacking Result Of Delayed Function
While converting my program using delayed, I stumbled upon a commonly used programming pattern that doesn't work with delayed. Example: from dask import delayed @delayed def myFunc
Solution 1:
Use the nout=
keyword as described in the delayed docstring
@delayed(nout=2)
def f(...):
return a, b
x, y = f(1)
Docstring
nout : int, optional
The number of outputs returned from calling the resulting ``Delayed``
object. If provided, the ``Delayed`` output of the call can be iterated
into ``nout`` objects, allowing for unpacking of results. By default
iteration over ``Delayed`` objects will error. Note, that ``nout=1``
expects ``obj``, to return a tuple of length 1, and consequently for
`nout=0``, ``obj`` should return an empty tuple.
Post a Comment for "Unpacking Result Of Delayed Function"