gpt4 book ai didi

Python 命名约定——namedtuples

转载 作者:太空狗 更新时间:2023-10-29 18:19:06 26 4
gpt4 key购买 nike

<分区>

我是 Python 的新手,我一直在阅读在线文档并(尝试)遵循 PEP 0008拥有良好的 Python 代码风格。我很好奇我在官方Python中找到的代码段docs在研究 re 库时:

import collections

Token = collections.namedtuple('Token', ['typ', 'value', 'line', 'column'])

我不明白为什么 Token 变量的首字母大写;我已经通读了 PEP 0008,但我所看到的内容没有引用资料。如果它是一个常量(据我所知它不是)?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com