Python & Java, in depth
Every feature. Real code.
Real output.
Each topic here was actually executed — Python 3.12 and OpenJDK 21 — and the recorded output is exactly what came back, not a description of what “should” happen. Every topic also carries an interview angle and an industry-practice note, and Python topics get a live, editable playground powered by Pyodide, running real CPython in your browser.
62
topics written
Python
A. Object model, identity & memory
6 topicsB. Iteration & generators
6 topics- dict/set size cannot change during iteration
- The iterator protocol: why
forcallsiter()exactly once - Generators: lazy, one-shot, and why they save memory
yield from, delegation, and generatorsend()/throw()/close()itertoolsdeep-dive- PEP 479:
StopIterationraised *inside* a generator becomesRuntimeError
C. Functions & closures
4 topicsD. Classes & OOP internals
5 topics@property,@staticmethod,@classmethod-- and the descriptor protocol underneath- The
__eq__/__hash__contract __repr__vs__str__, and why every class should define__repr__- Context managers:
__enter__/__exit__,contextlib.contextmanager,ExitStack - Dataclasses:
field(default_factory=...),__post_init__,frozen=True, generated__eq__
E. Typing & modern syntax
3 topicsF. Concurrency & parallelism
2 topicsG. Error handling
2 topicsH. Imports & packaging
1 topicJava
A. Object model, identity & memory
6 topics==vs.equals(), and the String constant pool- The
Integerautobox cache (-128..127) - The
hashCode/equalscontract - Records: compact constructors, generated equals/hashCode/toString
finalvs. true immutability, "effectively final" for lambda capture- Defensive copying, and why returning internal mutable state directly is a real bug
B. Generics
3 topicsC. Collections framework
5 topicsD. Streams & functional interfaces
5 topicsE. Concurrency
5 topicssynchronizedandvolatile: visibility vs. atomicity -- two different problems- Virtual threads (Project Loom, Java 21) vs. platform threads
CompletableFuturechaining:thenApply/thenCompose/thenCombine, sync vs. asyncThreadLocaland the classic thread-pool memory leak- Atomic classes (
AtomicInteger, CAS) vssynchronizedfor simple counters