All jobs / Automation developer
Automation developer interview question · 3–5 years
How do you compose several transformation stages over a huge stream without buffering?
The strongest answer
Chain generators so each stage yields to the next — nothing is materialised, memory stays constant, and any stage can stop the pipeline early
Why it works
Right. Composition without materialisation is what generators are for.
What a good answer covers
- Generators chain without buffering.
- Memory stays constant across stages.
- Early exit stops upstream work.
- itertools composes these cheaply.
Answers that fall short
- Close, but not the strongest: Build a list at each stage; it is clearer and the memory is fine
A list per stage is exactly the buffering you are trying to avoid. - Weak: Use threads, one per stage, with queues between them
Queues add machinery you do not need for a single-threaded pipeline. - Red flag: Read everything once and pass indices between stages
Indices assume the data is already in memory.
Who gets asked this
- Backend developer
- Full-stack developer
- Automation developer
- DevOps / SRE / cloud
- Data analyst / BI
- Data engineer
- Data science / ML / AI
- AI engineer
More Automation developer questions
- A Python service does heavy numeric work per request and latency is unacceptable. What options do you weigh?
- Under load your async service exhausts database connections. What went wrong?
- What is a decorator, really?
- You need setup and guaranteed teardown around a block. What do you write?
- Can you rely on a dict keeping insertion order?
- One synchronous database call inside an async handler makes the whole service slow. Why?
- Three independent API calls run one after another in an async function. How do you overlap them?