"매 small step, 매 feedback, 매 adjust, 매 repeat". Iteration 매 dual concept — (1) programming control flow (for, while, generators) 와 (2) development methodology (small increments + feedback loop). 2026 LLM-assisted 시대 매 iteration 매 even tighter — 매 minute 매 cycle 가능.
매 핵심
매 Programming iteration
Eager: for x in list — 매 list 매 fully materialized.
Lazy: generator, iterator — 매 on-demand pull.
Async: async for x in stream — 매 I/O 의 overlap.
Parallel: joblib, multiprocessing.Pool.imap — 매 CPU-bound iteration.
defread_jsonl(path:str):"""매 1GB+ file 의 stream — 매 memory O(1)."""importjsonwithopen(path)asf:forlineinf:yieldjson.loads(line)forrecordinread_jsonl("events.jsonl"):process(record)
Pattern 2: Itertools combinators
fromitertoolsimportislice,chain,groupby,accumulate# 매 first 100 records 만head=list(islice(read_jsonl("big.jsonl"),100))# 매 multiple sources 의 concatcombined=chain(read_jsonl("a.jsonl"),read_jsonl("b.jsonl"))# 매 group by usersorted_records=sorted(combined,key=lambdar:r["user_id"])foruser_id,groupingroupby(sorted_records,key=lambdar:r["user_id"]):handle_user(user_id,list(group))
importtimedefiterate_with_budget(items,budget_sec:float):start=time.time()foriteminitems:iftime.time()-start>budget_sec:print(f"매 budget 매 expire — {item} 의 stop")returnyieldprocess(item)
매 결정 기준
상황
Approach
Large file processing
Generator (lazy).
Multiple I/O calls
Async iteration.
CPU-bound loop
multiprocessing 또는 vectorize.
Numerical convergence
While + tolerance check.
Product development
2-week sprint + retrospective.
LLM agent
think-act-observe loop with max_iter cap.
기본값: Programming 매 generator-first; methodology 매 1-week iteration with measurable hypothesis.
언제: Agentic systems (think-act-observe), iterative refinement of code via LLM feedback, sprint planning summaries.
언제 X: Single-shot generation, tasks where each iteration is 1+ hours of human work (cycle too slow).
❌ 안티패턴
Eager when lazy works: list(huge_generator) — 매 OOM.
Unbounded loop: no max_iter — 매 infinite loop bug.
No feedback in iteration: 매 build without measure — methodology 매 broken.
Perfect first iteration: 매 ship at 70% — feedback 의 wait.
🧪 검증 / 중복
Verified: PEP 234 (iterators), Eric Ries "Lean Startup" (2011), "Continuous Delivery" (Humble & Farley).
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — full content covering both programming and methodology iteration with LLM agentic loop