I doubt that calling .compute() on delayed output immediately generally makes sense. delayed must be just avoided in those cases.
For those who are facing that issue in situations where a use of delayed is reasonable, there are other options.
Option 1: nout argument
@dask.delayed(nout=3)
def sum_nr(a,b):
return a+b, a, b
for i in range(10):
sum_ab, a, b = sum_nr(i, i+1)
# You need to call .compute() on necessary outputs at the end
Option 2: Explicit indexing
@dask.delayed
def sum_nr(a,b):
return a+b, a, b
for i in range(10):
res = sum_nr(i, i+1)
sum_ab, a, b = res[0], res[1], res[2]
# You need to call .compute() on necessary outputs at the end