Day 8: Stop Creating Lists — Iterators & Generators (Lazy Execution)
You think Python processes everything immediately. It doesn’t. Python can be lazy. Today, you understand how iteration really works under the hood. Today’s Goal By the end of today, you will: Understand iterator protocol Learn how generators work internally See how lazy execution saves memory Avoid unnecessary allocations The Illusion for i in [1,2,3]: print(i) You think: Python loops over the list directly Reality: Python asks for an iterator and pulls values one by one ...