Besides checking out PEP-8 yourself and learning more about it, you should definitely consider looking into the handypep8module, thepackage and some of the other alternatives that are described in the next sect
PEP 8: Style Guide for Python Code - Part 2 注1: 由HelgaE翻译,供学习交流用,欲查看原文见PEP8 - Naming Conventions 注2: 在本地使用vscode完成Markdown的编辑,并使用知乎专栏文章的导入文档选项直接导入,不排除有排版错误。没错因为Typora收费了就没有用了。 注3: 本文为第二部分,主要内容为命名规范;...
为了向前兼容,在Python3代码中的功能注释应该使用 PEP 484的语法规则。(在前面的章节中对注释有格式化的建议。) 不再鼓励使用之前在PEP中推荐的实验性样式。 然而,在stdlib库之外,在PEP 484中的实验性规则是被鼓励的。比如用PEP 484的样式标记大型的第三方库或者应用程序,回顾添加这些注释是否简单,并观察是否增加了...
是 Style Guide for Python Code,python代码的style guide 一、前提准备 在Python安装了pip的情况下,命令行输入 pip install autopep8 二、PyCharm设置 成...Python PEP8 代码规范常见问题及解决方法 Python 的 PEP8 代码规范,所以将常见的 PEP8 代码规范问题和解决方法记录一下,学习一下,遇到了再持续更新,...
Naming Conventions 命名规范 Python库的命名规范很乱,从来没能做到完全一致。但是目前有一些推荐的命名标准。新的模块和包(包括第三方框架)应该用这套标准,但当一个已有库采用了不同的风格,推荐保持内部一致性。 Overriding Principle 最重要的原则 那些暴露给用户的API接口的命名,应该遵循反映使用场景而不是实现的原则...
对IDE提示的好奇 在使用Python编程时,某函数setMainFrameColor()出现了黄色下划线并有以下信息 Function name should be lowercase less… (Ctrl+F1) Inspection info: This inspection checks the PEP8 naming conventions. 翻译过来就是: 函数名需要小...猜...
英文原文:PEP 8 -- Style Guide for Python Code 回到顶部 1. Introduction 介绍 本文提供的Python代码编码规范基于Python主要发行版本的标准库。Python的C语言实现的C代码规范请查看相应的PEP指南1。 这篇文档以及PEP 257(文档字符串的规范)改编自Guido原始的《Python Style Guide》一文,同时添加了一些来自Barry的风...
Why We Need PEP 8Naming ConventionsNaming StylesHow to Choose NamesCode LayoutBlank LinesMaximum Line Length and Line BreakingIndentationTabs vs. SpacesIndentation Following Line BreaksWhere to Put the Closing BraceCommentsBlock CommentsInline CommentsDocumentation StringsWhitespace in Expressions and Statements...
Check your code againstPEP 8naming conventions. This module provides a plugin forflake8, the Python code checker. (It replaces the pluginflint-namingfor theflintchecker.) Installation You can install, upgrade, uninstallpep8-namingwith these commands: ...
PythonPEP8编 码规范中文版 Code lay-out 代码布局 Indentation 缩进 Tabs or Spaces 制表符还是空格 Maximum Line Length 行的最大长度 Should a line break before or after a binary operator 在二元运算符之前应该换行吗 Blank Lines 空行 Source File Encoding 源文件编码 Imports 导入 Module level dunder nam...