Published: 28 Apr 2020 › Updated: 28 Apr 2020
Python Rules Of Coding: Naming Conventions
Previous
Python Rules Of Coding: Indentation
Python Rules Of Coding
Naming Conventions :
There are a lot of different Python naming conventions. It is recommended to apply these rules or conventions to our code. If we want to ensure our code's better quality, readability, and reusability. Applying name guidelines we can improve the performance and robustness of our Python Applications.
The rules or conventions :
- Always use a meaningful name.
- lowercase or lower_case_with_underscores. Ex. kalil, user_info
- Avoid too simple name like 'X', 'x', 'Y'
- The name of package, module in Python always should be lower case and short, if needs use an underscore as a separator to join multiple words and it should be a meaningful or logical name. Ex. csspec or css_spec
- Class names in Python follow the CapWords convention. We can also name a class like a function if the class is callable.
- The naming of the global variable, functions, and methods should follow the lowercase naming convention.
- Use 'self' as the first argument for an instance method and 'cls' as the first argument for class methods.
- Constants' names in Python always follow the UPPERCASE convention. We can use underscore(_) for joining multiple words.
Next
comments, String Quotes, and User Documentation
------------------------------------
Leave Python Rules Of Coding: Naming Conventions to:
Read more #stem posts
Best Posts From Hive-blogger
We have not curated any of alrashel's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Hive-blogger
- Bioengineering: How It Enhances Photosynthesis and Increases Yields in Food Crops
- Every programmer needs to know the Algorithms
- The booting operations phase of the modern computer system
- A Modern Perspective Of Operating Systems
- Moved to the appropriate community!
- Trading in a smart way.
- A Popular Data Structure In Python Programming : The List
- Bitcoin Is Going To The Back Of Its Price
- Let's Destroy Racism
- Web3 Decentralized Apps Keep Quarantined During The Global Epidemic.
- The Ethereum Name Service (ENS)
- Ethereum Enhances Transaction Privacy
- Primitive and non-primitive data structures in Python
- Python Rules Of Coding: Docstrings
- Python Rules Of Coding: String literals
- Python Rules Of Coding: Comments
- Python Rules Of Coding: Naming Conventions
- JavaScript : The Scripting Language
- Python Rules Of Coding: Indentation
- Python Data Types (fourth part)