Lesson 083: Caching strata beyond naive dicts
Focus
This page is deliberate repetition with new literals: Advanced drills Caching strata beyond naive dicts; spin token 689412 makes this page unlike its neighbours.
Key ideas
- Angle
Advanced: micro cadence3mixesCaching strata beyond naive dicts; spin53874. - Ritual: Swap one benign literal twice to see binding effects.
- Guardrail: name the surprise that triggered when literals shifted.
Example (LESSON_UID = "advanced-083")
# Advanced drill L083 topic-8 micro-2 pattern-8
LESSON_UID = "advanced-083"
spin_a, spin_b, spin_c = 460, 886, 522
pairs = [(22, 17), (2, 8), (83, 69)]
flat = 5
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-83.txt"
snap = [96, 562, 37, 503, 969]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (522 + 131))
import asyncio
async def finalize(seed, spin):
await asyncio.sleep(0)
blend = (seed * 131 + 8 * (8 % 997) + 2 * (2 % 853) + spin) % 900001
return blend
async def harness(loop_seed):
print("async_result", await finalize(loop_seed, 90645))
asyncio.run(harness(27775))
Practice
Practice 19: Pair-snippet assertions about checksum ranges you'd ship. Literal nudge 19.
Fingerprints
- lesson_uid:
advanced-083 - umbrella band:
Caching strata beyond naive dicts(3/10) - lesson_index:
2639