Python函数中使用@ 稍提一下的基础 fun 和fun()的区别 以一段代码为例: def fun(): print('fun') return None a = fun() #fun函数并将返回值给a print('a的值为',a) b = fun #将fun函数地址赋给b b() #调用b,b和fun指向的地址相同 print('b的值为',b) '''输出 fun a的值为 None fun b的值为 <function fun at 0x00000248E1EBE0D0> '''
作者:Charlie Marsh 译者:豌豆花下猫@Python猫 英文:Using Mypy in production at Spring (https://notes.crmarsh.com/using-mypy-in-production-at-spring) 在 Spring ,我们维护了一个大型的 Python 单体代码库(英:monorepo),用上了 Mypy 最严格的配置项,实现了 Mypy 全覆盖.简而言之,这意味着每个函数签名都是带注解的,并且不允许有隐式的 Any 转换.