Generators vs. Functions?
Neil Schemenauer
nas-usenet at arctrix.com
Sat Feb 4 22:31:24 EST 2006
Peter Hansen <peter at engcorp.com> wrote:
> More precisely, the state of the function is *saved* when a yield
> occurs, so you certainly don't *recreate* it from scratch, but merely
> restore the state, and this should definitely be faster than creating it
> from scratch in the first place.
Right. Resuming a generator is faster than calling a function.
Neil
More information about the Python-list
mailing list