Learning overview
- Estimated time
- 4 minutes
- Difficulty
- Beginner
- Prerequisites
- No prior experience required
- Learning outcome
- Explain python using a clear mental model · Apply python in practical Python work
- Last updated
- July 18, 2026
Assignment binds names to objects
Assignment does not copy an object. Two names can refer to the same mutable list, so a mutation through either name is visible through both. Rebinding one name does not change the other.
primary = ["Python"]
alias = primary
alias.append("SQL")
assert primary == ["Python", "SQL"]
alias = ["Java"]
assert primary == ["Python", "SQL"]Separate identity from equality
The == operator asks whether values compare equal. The is operator asks whether two references identify the same object. Use is for singletons such as None, not for strings or numbers.
Follow lexical scope
Python resolves names through local, enclosing, global, and built-in scopes. Avoid global mutable state; pass values into functions and return results. Use nonlocal or global only when the shared binding is deliberate and documented.
Frequently asked questions
Does Python have variables without types?
Names are not fixed to one type, but every object has a type. A name can be rebound to a different object unless a tool-enforced contract prevents it.
When should I use is in Python?
Use it for object identity, most commonly value is None or value is not None. Use == for value comparison.
Topic graph
A taxonomy-generated path through this subject.
Related courses
Related learning
Recommended automatically from shared technologies, topics, intent, and difficulty.
Related Guides
Related Tutorials
Related Glossary
Related Cheatsheets
Related Projects
Related Interview Questions
Related reading
Hand-picked companion pages that deepen this topic.
Your next steps
