Concept map
How these ideas connect Curated relationships between topics — solid lines connect ideas within a language that build on each other, dashed teal lines cross to the genuinely equivalent concept in the other language. Hover a dot for its title, click to open the topic.
Python Java A. Object model, identity & memory B. Iteration & generators C. Functions & closures D. Classes & OOP internals E. Typing & modern syntax F. Concurrency & parallelism G. Error handling H. Imports & packaging J. Stdlib gems A. Object model, identity & memory B. Generics C. Collections framework D. Streams & functional interfaces E. Concurrency F. Exceptions G. Modern language features (8 → 21) I. Modules & misc stdlib `is` vs `==`, the small-int cache, and string interning `is` vs `==`, the s… The mutable default argument trap The mutable default… Shallow vs deep copy Shallow vs deep copy `__slots__`: memory savings, what you lose `__slots__`: memory… Reference counting + generational cyclic GC Reference counting … Weak references Weak references dict/set size cannot change during iteration dict/set size canno… The iterator protocol: why `for` calls `iter()` exactly once The iterator protoc… Generators: lazy, one-shot, and why they save memory Generators: lazy, o… `yield from`, delegation, and generator `send()`/`throw()`/`close()` `yield from`, deleg… `itertools` deep-dive `itertools` deep-di… PEP 479: `StopIteration` raised *inside* a generator becomes `RuntimeError` PEP 479: `StopItera… Late-binding closures: the classic loop-variable-capture bug Late-binding closur… Positional-only (`/`) and keyword-only (`*`) parameters Positional-only (`/… `*args`/`**kwargs`: collection vs unpacking, and ordering rules `*args`/`**kwargs`:… Decorators silently destroy metadata unless you use `functools.wraps` Decorators silently… `@property`, `@staticmethod`, `@classmethod` -- and the descriptor protocol underneath `@property`, `@stat… The `__eq__`/`__hash__` contract The `__eq__`/`__has… `__repr__` vs `__str__`, and why every class should define `__repr__` `__repr__` vs `__st… Context managers: `__enter__`/`__exit__`, `contextlib.contextmanager`, `ExitStack` Context managers: `… Dataclasses: `field(default_factory=...)`, `__post_init__`, `frozen=True`, generated `__eq__` Dataclasses: `field… The walrus operator `:=` The walrus operator… `match`/`case` structural pattern matching (PEP 634) `match`/`case` stru… f-string `=` debug specifier and the format-spec mini-language f-string `=` debug … What the GIL actually protects (and what it doesn't) What the GIL actual… threading vs multiprocessing vs asyncio -- when each one actually helps threading vs multip… Exception chaining: `raise X from Y`, `__cause__` vs. implicit `__context__` Exception chaining:… `try`/`except`/`else`/`finally` -- what `else` is actually for `try`/`except`/`els… `sys.modules` as the import cache, and why circular imports fail the way they do `sys.modules` as th… `collections`: `Counter`, `defaultdict`, `deque`, `ChainMap` `collections`: `Cou… `enum`: `auto()`, `Flag` (bitwise combos), `StrEnum`/`IntEnum` `enum`: `auto()`, `… `==` vs `.equals()`, and the String constant pool `==` vs `.equals()`… The `Integer` autobox cache (-128..127) The `Integer` autob… The `hashCode`/`equals` contract The `hashCode`/`equ… Records: compact constructors, generated equals/hashCode/toString Records: compact co… `final` vs. true immutability, "effectively final" for lambda capture `final` vs. true im… Defensive copying, and why returning internal mutable state directly is a real bug Defensive copying, … Generics are erased at runtime Generics are erased… Bounded wildcards and PECS ("Producer Extends, Consumer Super") Bounded wildcards a… Unchecked warnings and heap pollution with varargs + generics Unchecked warnings … `List.of()` / `Map.of()` are truly immutable `List.of()` / `Map.… Fail-fast iterators: `ConcurrentModificationException` — and when it DOESN'T fire Fail-fast iterators… `Comparable` vs `Comparator` `Comparable` vs `Co… `HashMap` vs `LinkedHashMap` vs `TreeMap` ordering guarantees `HashMap` vs `Linke… `Collectors`: `groupingBy`, `partitioningBy`, `teeing`, `toUnmodifiableList` `Collectors`: `grou… Streams are lazy: nothing runs until a terminal operation Streams are lazy: n… `Optional`: `orElse` (always evaluated) vs `orElseGet` (lazy) `Optional`: `orElse… Method references: all four kinds Method references: … Functional interface composition: `andThen`/`compose`, `and`/`or`/`negate` Functional interfac… Parallel streams: the common `ForkJoinPool`, when it helps, ordering pitfalls Parallel streams: t… `synchronized` and `volatile`: visibility vs. atomicity -- two different problems `synchronized` and … Virtual threads (Project Loom, Java 21) vs. platform threads Virtual threads (Pr… `CompletableFuture` chaining: `thenApply`/`thenCompose`/`thenCombine`, sync vs. async `CompletableFuture`… `ThreadLocal` and the classic thread-pool memory leak `ThreadLocal` and t… Atomic classes (`AtomicInteger`, CAS) vs `synchronized` for simple counters Atomic classes (`At… Checked vs. unchecked exceptions -- the actual compiler-enforced difference Checked vs. uncheck… try-with-resources, `AutoCloseable`, and suppressed exceptions try-with-resources,… `finally` silently swallowing a `return`/exception from `try` `finally` silently … `var` local type inference (Java 10+) `var` local type in… Switch expressions + pattern matching for switch + `sealed`, working together Switch expressions … Text blocks (`"""`, Java 15+) Text blocks (`"""`,… `java.time` vs. legacy `Date`/`Calendar` `java.time` vs. leg… T1 topic T2 topic T3 topic builds on Python ↔ Java equivalent