Python Scope & the LEGB Rule: Resolving Names in Your Code – Real Python
In this step-by-step tutorial, you'll learn what scopes are, how they work, and how to use them effectively to avoid name collisions in your code. Additionally, you'll learn how to take advantage of a Python scope to write more maintainable and less buggy code.
Python Scope and the LEGB Rule: Resolving Names in Your Code – Real Python — FREE Email Series — 🐍 Python Tricks 💌 Get Python Tricks » 🔒 No spam. Unsubscribe any time. Browse Topics Guided Learning Paths Basics Intermediate Advanced ai algorithms api best-practices career community databases data-science data-structures data-viz devops django docker editors flask front-end gamedev gui machine-learning news numpy projects python stdlib testing tools web-dev web-scraping Table of Contents Understanding the Concept of Scope Names and Scopes in Python Scope vs Namespace in Python Resolving Name
related reading
- 9. Classes — Python 3.14.6 documentationdocs.python.org
- styleguide | Style guides for Google-originated open-source projectsgoogle.github.io
- Python Classes: The Power of Object-Oriented Programming – Real Pythonrealpython.com
- Scope (computer programming) - Wikipediaen.wikipedia.org
- The Global Object Patternpython-patterns.guide
- Facts and myths about Python names and values | Ned Batcheldernedbatchelder.com
- Object-Oriented Programming (OOP) in Python – Real Pythonrealpython.com
- How to Stand Out in a Python Coding Interview – Real Pythonrealpython.com
- PEP 810 – Explicit lazy imports | peps.python.orgpeps.python.org
- Python Virtual Environments: A Primer – Real Pythonrealpython.com
- Using .env Files for Environment Variables in Python Applications - DEV Communitydev.to
- Python's exec(): Execute Dynamically Generated Code – Real Pythonrealpython.com