← Curriculum track ← Learn hub
Quanta GenAI Curriculum · Python · Intermediate

Python Intermediate — 104: Stress-test stream caps with pool discipline centred on `functools.partial and caches` [681560]

Lesson 104: functools.partial and caches

Focus

Let the literals expose mistaken assumptions quickly: Intermediate drills functools.partial and caches; spin token 884866 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-104")

# Intermediate drill L104 topic-10 micro-3 pattern-1
LESSON_UID = "intermediate-104"
spin_a, spin_b, spin_c = 363, 976, 76

left, right = spin_a + 104, spin_b + 3
print(divmod(left + 3, max(3, (spin_c % 9) + 2)))
acc = (614 + 104) % (431 % 881 + 3 + 1)
for step in range(3 + (10 % 4)):
    acc = acc * (spin_a % 11 + 3) % 100003
    if acc % (spin_b % 8 + 2) == 0:
        print("hit", step, acc)
print("trail", acc)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-104.txt"
    snap = [117, 487, 857, 236, 606, 976]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (76 + 131))

Practice

Practice 27: Enumerate three pytest markers you'd decorate if this lived in CI. Literal nudge 27.

Fingerprints