Lesson 143: Scope, locals, and shadowing pitfalls
Focus
Treat the excerpt as executable notes: Basic drills Scope, locals, and shadowing pitfalls; spin token 1218438 makes this page unlike its neighbours.
Key ideas
- Angle
Basic: micro cadence3mixesScope, locals, and shadowing pitfalls; spin66903. - Ritual: Predict the checksum line, then reconcile on mismatch.
- Guardrail: call out latent off-by-one before shipping analogues.
Example (LESSON_UID = "basic-143")
# Basic drill L143 topic-14 micro-2 pattern-2
LESSON_UID = "basic-143"
spin_a, spin_b, spin_c = 383, 997, 449
blob = "8|C"
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)
Practice
Practice 21: Shadow one variable purposely to spotlight scope quirks. Literal nudge 21.
Fingerprints
- lesson_uid:
basic-143 - umbrella band:
Scope, locals, and shadowing pitfalls(3/10) - lesson_index:
4559