Yahoo Canada Web Search

Search results

      • 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.
      stackoverflow.com/questions/159720/what-is-the-naming-convention-in-python-for-variables-and-functions
  1. The Google Python Style Guide has the following convention: module_name, package_name, ClassName, method_name, ExceptionName, function_name, GLOBAL_CONSTANT_NAME, global_var_name, instance_var_name, function_parameter_name, local_var_name. A similar naming scheme should be applied to a CLASS_CONSTANT_NAME.

  2. However, you do not need to do it in Python since Python has properties. If you have this class: class Person(object): def __init__(self, name, age): self.name = name. self.age = age. ...and then you decide to validate ages, you do not need to change the person.age = age pieces of your code.

  3. Oct 8, 2024 · In this article, we'll delve into the specifics of Python Naming Conventions, covering modules, functions, global and local variables, classes, and exceptions. Each section will be accompanied by runnable code examples to illustrate the principles in action.

  4. Effective variable naming enhances code readability and maintainability. This post dives deep into the rules, conventions, and best practices for naming variables in Python, offering examples and tips to avoid common pitfalls.

  5. Sep 17, 2023 · This article delves into the art of naming variables in Python, following conventions and best practices to make your code not only functional but also comprehensible to fellow programmers.

  6. Jul 6, 2023 · To prevent conflicts and confusion, certain names should be avoided in Python. For instance, refrain from using built-in functions or module names as variable names. Additionally,...

  7. People also ask

  8. Oct 22, 2024 · Naming conventions in Python play a crucial role in writing clear and maintainable code. Special cases in naming can impact the way code is understood and used. This section focuses on underscores in function and variable names and the differences between public and internal interfaces.

  1. People also search for