问题描述
我正在编写一组 Python 函数,用于对源代码项目执行某种一致性检查.我想为这些函数指定相当冗长的名称,例如:check_5_theVersionOfAllVPropsMatchesTheVersionOfTheAutolinkHeader()
I'm writing a set of python functions that perform some sort of conformance checking on a source code project. I'd like to specify quite verbose names for these functions, e.g.: check_5_theVersionOfAllVPropsMatchesTheVersionOfTheAutolinkHeader()
这么长的名字会不会是python的问题?属性名称有最大长度吗?
Could such excessively long names be a problem for python? Is there a maximum length for attribute names?
推荐答案
2.3.标识符和关键字来自 Python 语言参考:
2.3. Identifiers and keywords from The Python Language Reference:
标识符的长度没有限制.
但是你会违反PEP-8 很可能,这不是很酷:
But you'll be violating PEP-8 most likely, which is not really cool:
将所有行限制为最多 79 个字符.
此外,您还将违反 PEP-20(禅宗蟒):
Also you'll be violating PEP-20 (the Zen of Python):
可读性很重要.
这篇关于python中属性名称的最大长度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!