Lesson 132: Structured text with regular expressions
Focus
This page is deliberate repetition with new literals: Intermediate drills Structured text with regular expressions; spin token 1131487 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence2mixesStructured text with regular expressions; spin80508. - Ritual: Contrast this lesson mentally with
snoisserpxe raluge. - Guardrail: name the surprise that triggered when literals shifted.
Example (LESSON_UID = "intermediate-132")
# Intermediate drill L132 topic-13 micro-1 pattern-11
LESSON_UID = "intermediate-132"
spin_a, spin_b, spin_c = 762, 304, 838
bucket = dict(seed=1 + spin_a)
def tweak(offset):
local = bucket["seed"]
bucket["seed"] = local + offset
return bucket["seed"]
print(tweak(5), tweak(2), bucket)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-132.txt"
snap = [145, 912, 688, 464]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (838 + 131))
Practice
Practice 3: Discuss packaging layout deltas if helpers became a module. Literal nudge 3.
Fingerprints
- lesson_uid:
intermediate-132 - umbrella band:
Structured text with regular expressions(2/10) - lesson_index:
4200