Browse by Topic
Popular
Popular Posts
Latest
Latest Python Posts
Python Local Variable Scope: How It Works
Understand how Python local variables work: scope resolution, lifetime, closures, and common errors like UnboundLocalError.
Python Variable Scope: LEGB, global, and nonlocal
Learn how Python resolves names with the LEGB rule and how to use global and nonlocal to modify variables in module-level and enclosing scopes.
Python Variable Naming Rules and Conventions
Understand Python's identifier syntax, reserved keywords, built-in shadowing, and PEP 8 naming conventions so your variable names are legal, clear, and maintainable.
How to Swap Variables in Python with Tuple Unpacking
Learn how to swap variables in Python with tuple unpacking, including evaluation order, list swaps, edge cases, and when a temporary variable is still useful.
Python Multiple Assignment: Syntax and Behavior
Python's multiple assignment evaluates the right side before assigning. This article covers variable swapping, iterable unpacking, star expressions, and common failure cases.
Python Variable Initialization: Avoiding Common Pitfalls
python variable initialization: Learn how to initialize Python variables correctly, avoid mutable default pitfalls, and choose between None, empty values, and type hints.
Python Variable Assignment: Names, References, and Mutability
Understand how Python variable assignment binds names to objects, why rebinding differs from mutation, and how aliasing affects real code.
Python Variable Declaration: Syntax and Scope
python variable declaration: Understand Python variable declaration: dynamic typing, type hints, scope, and best practices for clean, maintainable code.