See Python PEP 8: Function and Variable Names:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Variable names follow the same convention as function names.

mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.

Answer from S.Lott on Stack Overflow
🌐
Readthedocs
visualgit.readthedocs.io › en › latest › pages › naming_convention.html
Python Naming Conventions — CodingConvention 0 documentation
Class names should follow the UpperCaseCamelCase convention · Python’s built-in classes, however are typically lowercase words · Exception classes should end in “Error” · Global variables should be all lowercase · Words in a global variable name should be separated by an underscore ·
Discussions

Best practice for naming class instances?
Syntax is fine, but class Functions is big red flag to me. Is it a subset of some sequence class or a list, thus in plural? Is your subject area is functions themselves? Perhaps no, so there is a chance it is bad nane for a class, generally name it to the object you are describing. More on reddit.com
🌐 r/learnpython
8
4
May 16, 2023
coding style - Python file naming convention? - Software Engineering Stack Exchange
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. ... Class names should normally use the CapWords convention. More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
Is there a standard in naming your variables?
https://peps.python.org/pep-0008/#prescriptive-naming-conventions More on reddit.com
🌐 r/learnpython
30
38
February 12, 2024
Python Class Inheritance: Adhering to Parent Class Naming Conventions vs. PEP 8 Compliance
As PEP8 says at the beginning in the "A Foolish Consistency is the Hobgoblin of Little Minds" paragraph: good reasons to ignore a particular guideline: To be consistent with surrounding code that also breaks it I think that is the answer. More on reddit.com
🌐 r/learnpython
9
1
June 29, 2025
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-naming-conventions
Python Naming Conventions - GeeksforGeeks
July 23, 2025 - Classes in Python names should follow the CapWords (or CamelCase) convention.
🌐
Profound Academy
profound.academy › python-mid › class-naming-conventions-bxS5gJ9tLnPvyZhd5giU
Class Naming Conventions • Intermediate Python
January 18, 2025 - class MyCar: # class name uses CapWords def __init__(self): self.car_model = 'Tesla Model 3' # attribute name uses snake_case def start_engine(self): # method name uses snake_case print('Engine started!') While Python does not strictly enforce these naming conventions, adhering to them makes your code more professional, readable, and consistent.
🌐
Real Python
realpython.com › python-pep8
How to Write Beautiful Python Code With PEP 8 – Real Python
January 12, 2025 - What are some key naming conventions in PEP 8?Show/Hide · PEP 8 suggests using lowercase with underscores for functions and variables (snake case), camel case for classes, and uppercase with underscores for constants.
🌐
Medium
medium.com › @rowainaabdelnasser › python-naming-conventions-10-essential-guidelines-for-clean-and-readable-code-fe80d2057bc9
Python Naming Conventions: 10 Essential Guidelines for Clean and Readable Code | by Rowaina Abdelnasser | Medium
December 8, 2024 - For class names in Python, follow the CamelCase convention. Start each word with an uppercase letter, without any underscores or hyphens. Class names should be descriptive, reflecting the purpose or behavior of the class.
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › best practice for naming class instances?
r/learnpython on Reddit: Best practice for naming class instances?
May 16, 2023 -

As the title implies, I'm wondering what's best practice for naming class instances? I know pep-8 suggests lowercase but what is to actually call it is my question.

For example I have a class Functions(following PascalCasing) which contains several functions. When I create an instance of it, I normally just do functions = Functions(MYARGUMENTS)

I don't know if this would be considered bad practice.

🌐
Derekarmstrong
derekarmstrong.dev › blog › easy-to-understand-python-naming-conventions-and-coding-best-practices
Easy-to-Understand Python Naming Conventions and Coding Best Practices | Derek Armstrong — Payments Engineer · AI · Infrastructure
August 14, 2024 - Follow PEP 8: snake_case for variables and functions, PascalCase for classes, UPPER_SNAKE_CASE for constants. Consistency matters more than memorizing every rule. Use automated formatters like Black and isort. They enforce style automatically so you don’t waste mental energy on formatting debates. Name things to be descriptive, not clever. A variable name should explain what it holds without requiring a comment. Here are some useful links and resources for Python naming and style conventions according to the PEP 8 standard:
🌐
Execute Program
executeprogram.com › courses › python-for-programmers › lessons › naming-conventions
Python for Programmers: Naming Conventions
In Python, these use exactly the same syntax. Without additional context, we can't tell whether f() is calling a function named f or instantiating a class named f. UpperCamelCased class names reduce the ambiguity: user() is probably a function call, but User() is probably instantiating a class. The second exception to snake_case is that constants are conventionally SHOUTED.
🌐
Python Guides
pythonguides.com › python-naming-conventions
Naming Conventions In Python
March 30, 2026 - Decisive and consistent naming helps reduce errors and enhance collaboration among team members. PEP 8 is the Python style guide that offers recommendations for naming and coding style. It advises using snake_case for function and variable names, while CamelCase is preferred for class names.
🌐
Stack Abuse
stackabuse.com › python-naming-conventions-for-variables-functions-and-classes
Python Naming Conventions for Variables, Functions, and Classes
August 30, 2023 - Python's naming conventions for functions are similar to its conventions for variables. In Python, we typically use snake_case for function names. Here's an example: def calculate_sum(a, b): return a + b result = calculate_sum(5, 3) print(result) # Output: 8 · Note: It's a good practice to use verbs in function names since a function typically performs an action. In addition to snake_case, Python also uses PascalCase for naming classes, and occassionally camelCase, but we'll focus on those in another section.
🌐
GitHub
gist.github.com › etigui › 7600441926e73c3385057718c2fdef8e
Python naming conventions · GitHub
Class names should follow the UpperCaseCamelCase convention · Python's built-in classes, however are typically lowercase words · Exception classes should end with (suffix) “Exception” · Example: class PyramidGiza(): class InputException(): ...
🌐
Real Python
realpython.com › python-double-underscore
Single and Double Underscores in Python Names – Real Python
August 18, 2025 - By the end of this tutorial, you’ll ... intent: a single leading underscore signals a non-public name, a single trailing underscore helps avoid naming conflicts, and a double leading underscore triggers name mangling for class attributes and methods...
🌐
Medium
medium.com › @tuenguyends › python-naming-rules-and-conventions-fe18086cca16
Python’s naming rules and conventions | by Tue Nguyen | Medium
April 15, 2022 - Use all lowercase. Ex: name instead of Name · One exception: class names should start with a capital letter and follow by lowercase letters. Use snake_case convention (i.e., separate words by underscores, look like a snake).
Top answer
1 of 2
326

Quoting https://www.python.org/dev/peps/pep-0008/#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.

For classes:

Class names should normally use the CapWords convention.

And function and (local) variable names should be:

lowercase, with words separated by underscores as necessary to improve readability

See this answer for the difference between a module, class and package:

  • A Python module is simply a Python source file, which can expose classes, functions and global variables.
  • A Python package is simply a directory of Python module(s).

So PEP 8 tells you that:

  • modules (filenames) should have short, all-lowercase names, and they can contain underscores;
  • packages (directories) should have short, all-lowercase names, preferably without underscores;
  • classes should use the CapWords convention.

PEP 8 tells that names should be short; this answer gives a good overview of what to take into account when creating variable names, which also apply to other names (for classes, packages, etc.):

  • variable names are not full descriptors;
  • put details in comments;
  • too specific name might mean too specific code;
  • keep short scopes for quick lookup;
  • spend time thinking about readability.

To finish, a good overview of the naming conventions is given in the Google Python Style Guide.

2 of 2
94

Here is a link for different types of Python name conventions:

Type Public Internal
Packages lower_with_under
Modules lower_with_under _lower_with_under
Classes CapWords _CapWords
Exceptions CapWords
Functions lower_with_under() _lower_with_under()
Global/Class Constants CAPS_WITH_UNDER _CAPS_WITH_UNDER
Global/Class Variables lower_with_under _lower_with_under
Instance Variables lower_with_under _lower_with_under
Method Names lower_with_under() _lower_with_under()
Function/Method Parameters lower_with_under
Local Variables lower_with_under

The style guide for Python is based on Guido’s naming convention recommendations.

🌐
Delft Stack
delftstack.com › home › howto › python › python function naming
Naming Convention for Functions, Classes, Constants, and Variables in Python | Delft Stack
March 11, 2025 - This practice not only aids in ... to naming classes in Python, the convention is to use CamelCase, where each word starts with a capital letter and there are no underscores....
🌐
Medium
medium.com › @dasagrivamanu › python-naming-conventions-the-10-points-you-should-know-149a9aa9f8c7
Python Naming Conventions — The 10 Points You Should Know | by Dasagriva Manu | Medium
June 22, 2023 - All class methods should have ‘cls’ as their first argument. Function names should follow the lowercase naming convention. They should also use an underscore to separate words in a function name.
🌐
iO Flood
ioflood.com › blog › python-naming-conventions
Python Naming Conventions: Pythonic Style Guide
November 17, 2023 - Python’s naming conventions, as per PEP 8, suggest using lowercase_with_underscores for variable and function names, PascalCase for class names, and UPPER_CASE_WITH_UNDERSCORES for constants.