Coming from a C# background the naming convention for variables and method names are usually either camelCase or PascalCase.
// C# example
string isVariable= "a"
public void IsFunction()
In Python, I have seen the above but I have also seen underscores being used:
# python example
is_variable = 'a'
def is_function():
Is there a more preferable, definitive coding style for Python?
Aryan Kumar
18-Apr-2023In Python, there are naming conventions for variables, functions, and other identifiers. These conventions help to make the code more readable and understandable for other programmers. Here are the naming conventions in Python:
Variables: Variable names should be written in lowercase letters, with words separated by underscores. For example, “my_variable_name”.
Functions: Function names should also be written in lowercase letters, with words separated by underscores. For example, "my_function_name".
Krishnapriya Rajeev
21-Mar-2023The naming convention for variables is as follows:
a) Camel Case - The first letter of each word except the first is made capitalized.
Eg: mindStick
b) Snake Case - Words are separated using underscores.
Eg: mind_stick
c) Pascal Case - Each word starts with a capital letter
Eg: MindStick
The naming convention for functions are: