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

Python Intermediate — 101: Snapshot edge literals with typing overload tact centred on `functools.partial and caches` [784636]

Lesson 101: functools.partial and caches

Focus

Assume a reviewer executes this verbatim: Intermediate drills functools.partial and caches; spin token 852859 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-101")

# Intermediate drill L101 topic-10 micro-0 pattern-11
LESSON_UID = "intermediate-101"
spin_a, spin_b, spin_c = 654, 445, 133

bucket = dict(seed=0 + spin_a)

def tweak(offset):
    local = bucket["seed"]
    bucket["seed"] = local + offset
    return bucket["seed"]

print(tweak(2), tweak(4), bucket)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-101.txt"
    snap = [114, 772, 439]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (133 + 131))

Practice

Practice 30: Attach property-style expectations referencing tuple shapes. Literal nudge 30.

Fingerprints