- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the basic scoping rules for python variables?
In the book Learning Python by Mark Lutz, he suggests the following mnemonic for remember how Python scoping works: LEGB
Going from the narrowest scope to the widest scope:
L stands for “Local”. It refers to variables that are defined in the local scope of functions.
E stands for “Enclosing”. It refers to variables defined in the local scope of functions wrapping other functions. G stands for “Global”. These are the variables defined at the top level of files and modules.
B stands for “Built in”. These are the names that are loaded into scope when the interpreter starts up.
- What are the basic rules for defining variables in C++?
- What are the scoping rules for lambda expressions in Java?
- What are the basic rules and idioms for operator overloading in C++?
- What are the rules to declare variables in C++?
- What are the identity rules for regular expression?
- What are the rules for naming classes in C#?
- What are the golden rules for handling your money?
- What are the rules for calling the superclass constructor C++?
- What are the rules for a functional interface in Java?
- What are the basic responsibilities you have for your neighbours?
- What are the basic responsibilities you have for your country?
- What are the rules for the Subscriber interface in Java 9?
- What are the rules for the Subscription interface in Java 9?
- What are the rules for the Publisher interface in Java 9?
- What are different basic operators in Python?