Contents
What are the naming rules for function names?
When naming a function, variable or class, you should keep the following things in mind:
- Choose a word with meaning (provide some context)
- Avoid generic names (like tmp )
- Attach additional information to a name (use suffix or prefix)
- Don’t make your names too long or too short.
- Use consistent formatting.
What is Snake_case naming style?
Snake case (stylized as snake_case) refers to the style of writing in which each space is replaced by an underscore (_) character, and the first letter of each word written in lowercase. It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames.
What are the naming conventions for Python modules?
From PEP-8: Package and Module Names: Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.
What are the rules for naming a method in Python?
There are certain rules we need to follow while we are deciding a name for the method in python. Rule-1: You should use all lowercase while deciding a name for a method. Rule-2: If there are multiple words in your method name then they should be separated by an underscore (_).
Why are module names so short in Python?
Since module names are mapped to file names, and some file systems are case insensitive and truncate long names, it is important that module names be chosen to be fairly short — this won’t be a problem on Unix, but it may be a problem when the code is transported to older Mac or Windows versions, or DOS.
What do you call an extension module in Python?
When an extension module written in C or C++ has an accompanying Python module that provides a higher level (e.g. more object oriented) interface, the C/C++ module has a leading underscore (e.g. _socket). Modules should have short, all-lowercase names.