Learning overview
- Estimated time
- 4 minutes
- Difficulty
- Intermediate
- Prerequisites
- Learn Python: From Fundamentals to Real Applications · Python OOP: Classes, Dataclasses, and Composition
- Learning outcome
- Explain python using a clear mental model · Apply python in practical Python work
- Last updated
- July 18, 2026
Core answer
Python names refer to objects. Assignment binds a name; it does not copy an object. Mutating a list through one reference is visible through every other reference to that same list.
Lists are mutable ordered sequences, tuples are immutable ordered sequences, dictionaries map hashable keys to values, and sets store unique hashable members. Choose from required semantics rather than syntax preference.
Iterables can produce iterators, and iterators yield values one at a time until StopIteration. Generator functions use yield to create iterators with suspended execution, enabling lazy pipelines and bounded memory use.
Worked example
A common interview question asks why mutable default arguments retain values across calls and how to fix the function.
def add_tag(tag: str, tags: list[str] | None = None) -> list[str]:
if tags is None:
tags = []
tags.append(tag)
return tagsFollow-up questions
Strong interviews test whether you can apply the idea, not only recite a definition. Practice answering these out loud.
- What is the difference between is and ==?
- Why must dictionary keys be hashable?
- How do shallow and deep copies differ?
- What are *args and **kwargs?
- What is a context manager?
- How do iterators and generators differ?
- When would you use a dataclass?
- What is method resolution order?
- How should exceptions be chained?
- What does the GIL affect and what does it not guarantee?
Frequently asked questions
How should I prepare for Python interviews?
Trace names and objects, implement small collection transformations, explain exceptions and context managers, and test code under empty, invalid, and boundary inputs.
Should I memorize Python internals?
Know the language-level object and iteration models. Distinguish specification guarantees from CPython implementation details when discussing internals.
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
