Lesson 029: Custom iterators and iter() bridges
Focus
Let the literals expose mistaken assumptions quickly: Intermediate drills Custom iterators and iter() bridges; spin token 279268 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence9mixesCustom iterators and iter() bridges; spin56913. - Ritual: List two regressions CI should catch later.
- Guardrail: pick the budget that keeps this rehearsal honest.
Example (LESSON_UID = "intermediate-029")
# Intermediate drill L029 topic-2 micro-8 pattern-9
LESSON_UID = "intermediate-029"
spin_a, spin_b, spin_c = 120, 416, 890
def helper(x, bias=93):
return (x * bias + 8) % 5009
samples = [helper(29 + k) for k in range(3 + 2 % 4)]
print(samples, max(samples) - min(samples))
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-29.txt"
snap = [42, 174, 306]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (890 + 131))
Practice
Practice 32: Pair-snippet assertions about checksum ranges you'd ship. Literal nudge 32.
Fingerprints
- lesson_uid:
intermediate-029 - umbrella band:
Custom iterators and iter() bridges(9/10) - lesson_index:
953