python - Python 语法中的 FPDEF 和 TFPDEF 是什么意思?
问题描述
我阅读了 Python 的语法文件(https://docs.python.org/3/reference/grammar.html),但我不明白 TFPDEF 和 FPDEF 是什么意思。我希望你能帮帮我 :)
解决方案
Python 3.8 版本有更多注释解释它
它们基本上只是NAME
s (T
变体有一个可选的类型声明),所以:
def foo(a, b): pass
将通过以下规则子集进行解析:
funcdef: 'def' NAME parameters ':' func_body_suite
parameters: '(' [typedargslist] ')'
typedargslist: tfpdef (',' tfpdef)*
tfpdef: NAME
func_body_suite: simple_stmt
simple_stmt: small_stmt NEWLINE
small_stmt: pass_stmt
推荐阅读
- python - 从对创建一个元组
- wordpress - Wordpress 无法加载脚本
- c# - 确定我收到的 CSV 文件版本/类型,以便我可以将其添加到模型中
- ruby-on-rails - monit 和 unicorn restart 命令在 rails 5.2 应用程序中不起作用
- eclipse-rcp - 没有为 NOTES 配置 LoginModules
- r - 按月绘制最低和最高温度
- java - 我如何将片段称为活动?
- python - 将字符串转换为 int 时出现“溢出错误:Python int 太大而无法转换为 C long”
- c# - 我应该如何在实体框架中创建这种关系?
- typescript - 在第一个泛型上显式但在 TS 中推断出第二个?