Replacing do_project_a and do_project_b with Custom Snake Case Code Works
“If I replace the do project a and the do project b part with my stuff in snake case it will do the stuff I write in snake case if True: do_project_A() do_project_B()”
Summary
Python accepts function names written in snake_case, and the language’s naming conventions (PEP 8) prescribe this style for functions. Therefore, replacing `do_project_A()` and `do_project_B()` with your own snake_case functions will execute them when the `if True:` condition is met, as long as those functions are defined. This behavior aligns with the standard naming practices documented in the sources.
Sources 60 searched
- Why in PEP 8 was decided both vars and functions to be snake case? - Python Help - Discussions on Python.org
As title. When I started to learn Python, I preferred to use snake case for vars and lower camel case for functions, to better distinguish them. Why in PEP 8 it was preferred to use an unique style for vars and funcs?
- Snake case - Wikipedia
It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames. One study has found that readers can recognize snake case values more quickly than camel case. However, "subjects were trained mainly in the underscore style", so the possibility of bias cannot be eliminated. A variation is screaming snake case, where words are written in all caps (stylized as SCREAMING_SNAKE_CASE). This convention is used for constants in programming languages like C/C++, Python, Java, PHP, as well as for environment variables.
- PEP 8 – Style Guide for Python Code | peps.python.org
In Python, this style is generally deemed unnecessary because attribute and method names are prefixed with an object, and function names are prefixed with a module name. In addition, the following special forms using leading or trailing underscores ...
- Naming Styles - Pylint
def valid_snake_case(arg): ... def InvalidCamelCase(arg): ... def more_valid_snake_case(arg): ... Because of this, the name on line 4 will trigger an invalid-name warning, even though the name matches the given regex. Matches named exempt or ignore can be used for non-tainting names, to prevent built-in or interface-dictated names to trigger certain naming styles. ... Format: comma-separated groups of colon-separated names. This option can be used to combine name styles. For example, function:method enforces that functions and methods use the same style, and a style triggered by either name type carries over to the other.
- Python Snake Case: A Comprehensive Guide - CodeRivers
The main purpose of snake case is to improve code readability. By separating words with underscores, it becomes easier to distinguish between different parts of a name, especially when the name is long. This convention is used for naming variables, functions, and non-public class attributes ...
- Programming Naming Conventions – Camel, Snake, Kebab, and Pascal Case Explained
Now, based on the language you're working on and what you're naming, the preferred case type can change. For example, according to the PEP 8 – Style Guide for Python Code, variable and function names should use snake case:
- snake case | Python Glossary – Real Python
In programming, snake case is a naming convention where you write compound names by joining words with underscores (_) and using only lowercase letters. Using underscores to separate words in an identifier improves readability.
- naming conventions - Should I use "camel case" or underscores in Python? - Stack Overflow
Which is absolutely contradictory with the fact that a camel cased group of words form an unambiguous solid symbol that looks like a single object matching the idea that a method name is one thing (as opposed to several objects, words, that have to be read and later interpreted as one single group of several things). That's even worst for _ if the method name contains a reserved word in it. 2015-03-19T02:15:10.25Z+00:00 ... Of course, Python uses snake_case.
- I've seen plenty of people using Python use camelCase, but should you use snake_case? (Example) | Treehouse Community
Variable, method, and function names should always be snake_case (wonder where it got that name?). You'll see camelCase in some really old Python code but it's not the modern convention at all.