Tracing a generator's execution reveals a fundamentally different way Python can run code.

A generator function looks like a regular function but behaves in a fundamentally different way. Understanding that difference requires tracing through what Python actually does when it executes one.

The Key Difference

A regular function runs to completion when called. A generator function returns an iterator object immediately without running any of its code.

def regular():