Lesson 025: Custom iterators and iter() bridges
Focus
Compare against yesterday's mental model politely: Intermediate drills Custom iterators and iter() bridges; spin token 241201 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence5mixesCustom iterators and iter() bridges; spin28343. - Ritual: Mirror the snippet with reversed iteration order verbally.
- Guardrail: promise one security boundary if this touched user data.
Example (LESSON_UID = "intermediate-025")
# Intermediate drill L025 topic-2 micro-4 pattern-2
LESSON_UID = "intermediate-025"
spin_a, spin_b, spin_c = 627, 825, 686
blob = "50|E"
head, sep, tail = blob.partition("|")
print(tuple(zip(head, reversed(tail))))
filt = [ch for ch in head if ord(ch) % (spin_a % 5 + 2) != 0]
print("filt", filt)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-25.txt"
snap = [38, 673, 317]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (686 + 131))
Practice
Practice 22: Swap print order once; reconcile dependency thinking. Literal nudge 22.
Fingerprints
- lesson_uid:
intermediate-025 - umbrella band:
Custom iterators and iter() bridges(5/10) - lesson_index:
797