Skip to content

Python class name convention

  • by

Python class name convention would be the first letter of each word in the class name should be capitalized, and there should be no underscores between the words.

class CamelCase 

Python class name convention examples

Simple example code. According to the PEP 8 style guide for Python code, class names should always start with a capital letter. This convention helps to distinguish class names from function names and variables, which typically use lowercase names with underscores between words.

class MyClassName:
pass

def my_function_name():
pass

my_variable_name = 10


print(type(MyClassName))

Output:

Python class name convention

Do comment if you have any doubts or suggestions so this Python class name topic.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading