1,280 results
Open links in new tab
  1. Python Scope - W3Schools

    If you operate with the same variable name inside and outside of a function, Python will treat them as two separate variables, one …

  2. Python Scope and the LEGB Rule: Resolving Names in Your Code

    Jul 16, 2025 · This scope contains names such as built-in functions, exceptions, and other attributes that are built into Python. …

  3. python - Short description of the scoping rules - Stack Overflow

    May 16, 2019 · If a name is ever assigned to in the current scope (except in the class scope), it will be considered belonging to that …

  4. Python Scope of Variables - GeeksforGeeks

    Jul 12, 2025 · Global variables are the ones that are defined and declared outside any function and are not specified to any function. …

  5. Scope - Learn Python

    Where a variable is created decides where it can be used. That's called its scope. Understanding scope explains some confusing …

  6. Python Variable Scope: Local, Global, Nonlocal and LEGB

    Oct 4, 2026 · Scope decides where a Python variable can be seen: a name created inside a function is local, and a name at the top …

  7. Namespaces and Scope in Python - GeeksforGeeks

    Jun 9, 2026 · Every variable, function and class is associated with a name. As programs grows, Python needs a systematic way to …

  8. Functions and Scopes (Learning Path) – Real Python

    In this learning path, you’ll build a strong foundation in Python functions and scope. You’ll start by defining functions and working with …

  9. Python Scope - W3Schools

    If you operate with the same variable name inside and outside of a function, Python will treat them as two separate variables, one …

  10. Python Scope - NetworkLessons.com

    This lesson explains the Python local and global scope for variables and how you can use the global parameter to make function …