forum

Home / DeveloperSection / Forums / What is the naming convention in Python for variable and function?

What is the naming convention in Python for variable and function?

Erick Wilsom 311 27-Oct-2022

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?


Updated on 18-Apr-2023
Writing is my profession! I have written hundreds of article for many organizations and looking forward to work with growing organization. I am compatible to produce content in many categories including International politics, Healthcare, Education, Lifestyle, etc.. I understand the value of your time that you have invested to read my bio. #thanks

Can you answer this question?


Answer

2 Answers

Liked By