这个
初始化
类中的函数按以下方式进行注释:
def __init__(self, directory: str, transforms: Callable = None, extension: str = '.jpg'):
问题是什么
Callable = None
指的是。
按照惯例,如果
transforms
-参数注释意味着引入一个可调用(即函数),然后需要定义输入参数和输出,例如:
transforms: Callable[[int,int], int]
在哪里
[int,int] would be the function parameters as input, and the latter
int将是回报。但事实并非如此。
这是什么意思
Callable
在这种情况下,注释是否作为输入和返回?