Function annotation in python 3 get “name not defined” error

前端 未结 2 1339
长发绾君心
长发绾君心 2021-01-22 08:37

I am trying to use python3 type annotation features.

Here is some toy functions without annotation:

def fa(func, *args):
    return func(*args)
def fb(x:         


        
2条回答
  •  时光取名叫无心
    2021-01-22 09:20

    Because you define a variable in function parameters,but that parameter is not exist out of function.You have to write

    fa(function="Newton")

提交回复
热议问题