在使用延迟转换我的程序时,我偶然发现了一种常用的编程模式,该模式不适用于延迟.例:
from dask import delayed
@delayed
def myFunction():
return 1,2
a, b = myFunction()
a.compute()
Run Code Online (Sandbox Code Playgroud)
提高:TypeError: Delayed objects of unspecified length are not iterable
虽然以下解决方法没有.但看起来更笨拙
from dask import delayed
@delayed
def myFunction():
return 1,2
dummy = myFunction()
a, b = dummy[0], dummy[1]
a.compute()
Run Code Online (Sandbox Code Playgroud)
这是预期的行为吗?