2.7.1 The accepted style conventions and how these are implemented to create readable and maintainable code Flashcards
State:
2 reasons to use defined style conventions
- Consistent format
- Maintainability
State:
The current style convention for Python
PEP8 - Python Enhancement Proposal
State:
4 things that PEP8 provides guidelines for
4 of:
* Naming conventions/styles
* Use of comments
* Use of white space
* The structure of the code
* Indentation
State:
Why it is not possible to enforce the PEP8 convention?
It is an open-source programming language
Fill The Blank:
Names in python must be ……….. and …………… to be easy to understand what they represent
Naming conventions
Logical, Sensible
Fill The Blank:
Irrelevant or inappropriate ………. can make it difficult to locate ………. during maintanence or ……………….
Naming conventions
Names, Errors, Debugging
State:
Convention for constants
Naming conventions
Capital single letter, word or words with words seperated by underscores _
State:
Convention for functions
Naming conventions
Lowercase word or words with words seperated by underscores _
State:
Convention for module
Naming conventions
Short, lowercase word or words with words seperated by underscores _
State:
Convention for variable
Naming conventions
Lowercase signle letter, word or words with no whitespace or special characters and words seperated by underscores _
State:
Symbol used to start a comment in python
Use of comments
#
Fill The Blank:
Comments make code easier to ……………… as the meaning of the code is explained
Use of comments
Maintain
Fill The Blank:
Comments should not explain obvious elements of a program but explain ………… elements
Use of comments
Implicit
Fill The Blank:
White space helps code look less …………….. and helps with …………….. and understandibility.
Use of white space
Cluttered, Readability
Fill The Blank:
If code contains too much white space then it can be difficult to understand which ……………… of code should be read together
Use of white space
Elements