我在python中有一个函数可以返回a bool或a list.有没有办法使用类型提示指定返回类型.
bool
list
例如,这是正确的方法吗?
def foo(id) -> list or bool: ...
python return-type type-hinting python-3.x python-3.5
python ×1
python-3.5 ×1
python-3.x ×1
return-type ×1
type-hinting ×1