我已经阅读了PEP 257。但它没有说明如何指定函数参数的类型。
以下是推荐的吗?
def decrypt_and_verify_bundle(bundle_file):
"""
Decrypts and verifies a bundle
:param bundle_file: string
absolute path to the bundle file
:return: string
tar file present in the bundle
"""
PEP 484为Python 2.7建议了以下语法(注意,由于您没有提到run_local函数的返回类型,我在这里假设None
(:
def run_local(cmd, raise_exception=True, console_print=True, use_shell=True):
# type: (Union[str, List[str]], bool, bool, bool) -> None