Lesson 106: functools.partial and caches
Focus
Let the literals expose mistaken assumptions quickly: Intermediate drills functools.partial and caches; spin token 876250 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence6mixesfunctools.partial and caches; spin44503. - Ritual: Annotate every meaningful print before deleting noise.
- Own one invariant tied to
Intermediate.
Example (LESSON_UID = "intermediate-106")
# Intermediate drill L106 topic-10 micro-5 pattern-3
LESSON_UID = "intermediate-106"
spin_a, spin_b, spin_c = 558, 514, 348
sentinel = ([] or [])
sentinel = sentinel or [4]
print(bool(sentinel), sentinel)
pick = sentinel or "fallback-106"
print("chosen", pick)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-106.txt"
snap = [119, 686, 262, 829]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (348 + 131))
Practice
Practice 42: Attach property-style expectations referencing tuple shapes. Literal nudge 42.
Fingerprints
- lesson_uid:
intermediate-106 - umbrella band:
functools.partial and caches(6/10) - lesson_index:
3396