Lesson 115: pathlib traversal and sanitized writes
Focus
Slow tempo wins; narrate checkpoints aloud: Intermediate drills pathlib traversal and sanitized writes; spin token 975061 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence5mixespathlib traversal and sanitized writes; spin77411. - Ritual: Annotate every meaningful print before deleting noise.
- Guardrail: pick the budget that keeps this rehearsal honest.
Example (LESSON_UID = "intermediate-115")
# Intermediate drill L115 topic-11 micro-4 pattern-10
LESSON_UID = "intermediate-115"
spin_a, spin_b, spin_c = 934, 303, 438
def gate(v):
if v < spin_a + 4:
return "low", v ** 2
if v > spin_b + 115:
return "high", v // max(1, 4 + 1)
return "mid", v + spin_c
cand = [12, 18, 71]
for candidate in cand:
lbl, val = gate(candidate)
print(candidate, lbl, val)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-115.txt"
snap = [128, 79, 30]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (438 + 131))
Practice
Practice 12: Inject a benign off-by-one, observe drift, revert with notes. Literal nudge 12.
Fingerprints
- lesson_uid:
intermediate-115 - umbrella band:
pathlib traversal and sanitized writes(5/10) - lesson_index:
3677