关于python函数嵌套问题


学python时候对于这种闭包还算能理解
def max_length(n):


 def validator(s):
    if len(s) < n:
        return
    raise Exception('Length of string must be less than {0}!'.format(n))
return validator

但如果是这种:

图片描述

就不知道该如何运行了,因为嵌套太多函数了

python 装饰器 闭包

FTAL白告皓 8 years, 7 months ago

不知道该如何运行为什么要写呢?另外你的问题排版没做好。


 @pre_str('//')
def my_func():
  pass

爱潜水的河马 answered 8 years, 7 months ago

Your Answer