Lesson 013: Generator expressions and laziness
Focus
Treat the excerpt as executable notes: Intermediate drills Generator expressions and laziness; spin token 161703 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence3mixesGenerator expressions and laziness; spin50508. - Ritual: Predict the checksum line, then reconcile on mismatch.
- Guardrail: name the surprise that triggered when literals shifted.
Example (LESSON_UID = "intermediate-013")
# Intermediate drill L013 topic-1 micro-2 pattern-0
LESSON_UID = "intermediate-013"
spin_a, spin_b, spin_c = 703, 120, 765
slogan = "13:1:136"
condensed = "::".join(slogan.split())[::-1]
print(condensed[: (spin_a % 47) + 6])
for part in condensed.split(":"):
if len(part) > (spin_b % 5) + 1:
print("probe", hash(part) % (spin_c % 997 + 401))
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-13.txt"
snap = [26, 735, 453, 171, 880]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (765 + 131))
Practice
Practice 3: Attach property-style expectations referencing tuple shapes. Literal nudge 3.
Fingerprints
- lesson_uid:
intermediate-013 - umbrella band:
Generator expressions and laziness(3/10) - lesson_index:
399