About 547,000 results
Open links in new tab
  1. What is the naming convention in Python for variables and functions

    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. PEP = Python Enhancement Proposal.

  2. PEP 8 – Style Guide for Python Code | peps.python.org

    Jul 5, 2001 · Use 4 spaces per indentation level. Continuation lines should align wrapped elements either vertically using Python’s implicit line joining inside parentheses, brackets and braces, or using a hanging indent [1].

  3. Python Naming Conventions - GeeksforGeeks

    Oct 8, 2024 · What is Naming Conventions in Python? Naming conventions in Python refer to rules and guidelines for naming variables, functions, classes, and other entities in your code. Adhering to these conventions ensures consistency, …

  4. Naming Conventions in Python - Python Guides

    Oct 22, 2024 · Python has established guidelines, such as PEP 8, which recommend specific styles for naming variables, functions, classes, and more. By using these guidelines, programmers can make their code clear and organized.

  5. Python Naming Conventions: A Guide to Clean and Readable Code

    Feb 25, 2025 · Function names should be in lowercase, and words should be separated by underscores (snake case), following PEP 8 guidelines. The name should clearly describe what the function does. A good function name should be able to convey the purpose of the function at a …

  6. Python Naming Conventions: 10 Essential Guidelines for Clean

    Jul 6, 2023 · When it comes to naming variables, functions, classes, and modules in Python, the overriding principle is clarity and readability. Your code is read more often than it is written, so...

  7. How Do You Choose Python Function Names? – Real Python

    Jul 10, 2024 · In this tutorial, you learned how to choose Python function names that follow the core naming rules and the conventions defined by Python’s style guide. Function names contain all lowercase letters.

  8. How to Name Functions in Python - dummies

    Mar 26, 2016 · The rules for naming a function are a lot like rules for naming a variable: They must start with a letter or an underscore: _. They should be lowercase. They can have numbers. They can be any length (within reason), but keep them short. They can't be the same as a …

  9. Python Function Naming Conventions: A Comprehensive Guide

    Mar 25, 2025 · This blog post will dive deep into Python function naming conventions, covering the basics, usage, common practices, and best practices. In Python, a function name must follow certain rules. It can only contain letters (both uppercase and lowercase), digits, and underscores (_). The name cannot start with a digit.

  10. Python Naming Conventions for Variables, Functions, and Classes

    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: print (result) # Output: 8. Note: It's a good practice to use verbs in function names since a …

  11. Some results have been removed
Refresh