Lesson 059: Classes encapsulating mutable state
Focus
Treat the excerpt as executable notes: Intermediate drills Classes encapsulating mutable state; spin token 510090 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence9mixesClasses encapsulating mutable state; spin30047. - Ritual: Annotate every meaningful print before deleting noise.
- Guardrail: pick the budget that keeps this rehearsal honest.
Example (LESSON_UID = "intermediate-059")
# Intermediate drill L059 topic-5 micro-8 pattern-8
LESSON_UID = "intermediate-059"
spin_a, spin_b, spin_c = 831, 223, 741
pairs = [(28, 65), (8, 5), (59, 137)]
flat = 17
for left, right in sorted(pairs):
print(left ^ right + flat % 997)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-59.txt"
snap = [72, 915, 767]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (741 + 131))
Practice
Practice 44: Clone twice: expand literals vs shrink loops; compare narrative. Literal nudge 44.
Fingerprints
- lesson_uid:
intermediate-059 - umbrella band:
Classes encapsulating mutable state(9/10) - lesson_index:
1913