Lesson 145: Scope, locals, and shadowing pitfalls
Focus
Anchor one invariant before you branch mentally: Basic drills Scope, locals, and shadowing pitfalls; spin token 1242039 makes this page unlike its neighbours.
Key ideas
- Angle
Basic: micro cadence5mixesScope, locals, and shadowing pitfalls; spin31867. - Ritual: List two regressions CI should catch later.
- Guardrail: separate demo-trick from shipping discipline verbally.
Example (LESSON_UID = "basic-145")
# Basic drill L145 topic-14 micro-4 pattern-7
LESSON_UID = "basic-145"
spin_a, spin_b, spin_c = 292, 860, 358
src = [((k + 145) * spin_a + 4) % 241 for k in range(4 + 4 % 3)]
derived = [v * v if v % 2 == 0 else v + spin_b for v in src]
print("src", src)
print("derived", derived)
print("zip_sum", sum(x + y for x, y in zip(src, derived)))
Practice
Practice 27: Attach property-style expectations referencing tuple shapes. Literal nudge 27.
Fingerprints
- lesson_uid:
basic-145 - umbrella band:
Scope, locals, and shadowing pitfalls(5/10) - lesson_index:
4637