Lesson 114: pathlib traversal and sanitized writes
Focus
Treat the excerpt as executable notes: Intermediate drills pathlib traversal and sanitized writes; spin token 998521 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence4mixespathlib traversal and sanitized writes; spin78190. - Ritual: Swap one benign literal twice to see binding effects.
- Guardrail: separate demo-trick from shipping discipline verbally.
Example (LESSON_UID = "intermediate-114")
# Intermediate drill L114 topic-11 micro-3 pattern-10
LESSON_UID = "intermediate-114"
spin_a, spin_b, spin_c = 719, 556, 92
def gate(v):
if v < spin_a + 3:
return "low", v ** 2
if v > spin_b + 114:
return "high", v // max(1, 3 + 1)
return "mid", v + spin_c
cand = [9, 17, 164]
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-114.txt"
snap = [127, 853, 588, 323, 58, 784]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (92 + 131))
Practice
Practice 37: Rename locals for domain vocabulary-only; keep behaviour identical. Literal nudge 37.
Fingerprints
- lesson_uid:
intermediate-114 - umbrella band:
pathlib traversal and sanitized writes(4/10) - lesson_index:
3638