Python编程
Completion requirements
Python 程序中使用了各种命名约定。
PEP 0008 规定了类名(例如 GenericTree
)、包和模块名(例如 generictree
和 generic_tree
)、函数和变量名(storestate
或 store_state
;不推荐使用 mixedCase
)等的命名约定。Google Python 风格指南遵循类似的命名约定。
上述约定与 Java 命名约定(例如方法名使用 storeState
)和 C# 命名约定(例如方法名使用 StoreState
)形成对比。
在 Python 2 中,标准库包含多个与 PEP 0008 的偏差。例如,Tkinter 模块拼写为 Tkinter
,首字母大写;这在 Python 3 中被重命名为 tkinter
。
Last modified: Friday, 31 January 2025, 2:04 AM