示例工程 10-type-annotations-mypy

10-type-annotations-mypy/02-mypy-catches/before.py.txt

text · 0.2 KB

"""strict 之前:缺注解,且有一处赋值类型不匹配。"""
 
 
def total(values):
    result = 0
    for value in values:
        result += value
    return result
 
 
def parse(text: str) -> int:
    value: int = text
    return value