Exercise py-02 — lazy token pipeline

Four generator stages — read → normalise → chunk → batch — the same shape generator pipelines just walked. This time you write the stages, and eight checks grade whether they are still generators once you're done: lazy, constant-memory, and honest about the edge cases a real chunking pipeline hits.

~75 minruns in the browser 8 checkspy-02

What you're building

The checks are ordinary Python and ship with the page like everything else on a static site — you could read them in devtools if you wanted. They assert what your pipeline does with real inputs (a 10,000-token stream, a 1,000,000-token one, a poisoned source that screams if you over-read it), not how you write the code to do it.

If you get stuck