Lesson 089: Inheritance, super(), delegation patterns
Focus
This page is deliberate repetition with new literals: Intermediate drills Inheritance, super(), delegation patterns; spin token 772776 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence9mixesInheritance, super(), delegation patterns; spin78706. - Ritual: Add one doctest-style assertion comment above hottest print.
- Guardrail: name the surprise that triggered when literals shifted.
Example (LESSON_UID = "intermediate-089")
# Intermediate drill L089 topic-8 micro-8 pattern-6
LESSON_UID = "intermediate-089"
spin_a, spin_b, spin_c = 786, 804, 721
start = 19 + 8 % 5
leap = 5
span = 25
bucket = []
for idx in range(start, start + span):
bucket.append(idx * (spin_a % 37 + leap))
squares = tuple(x * x if x % 2 == (8 % 2) else -x for x in bucket[-4:])
print(bucket, squares)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-89.txt"
snap = [102, 900, 707]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (721 + 131))
Practice
Practice 21: Enumerate three pytest markers you'd decorate if this lived in CI. Literal nudge 21.
Fingerprints
- lesson_uid:
intermediate-089 - umbrella band:
Inheritance, super(), delegation patterns(9/10) - lesson_index:
2873