[Tutor] Is generator function similar to multi threading?

Kent Johnson kent37 at tds.net
Fri Mar 16 11:15:01 CET 2007


ammar azif wrote:
> Is generator function similar to multi threading?

Only in that they can be alternative ways to solve the same problem.

Generator functions are similar to co-routines and can be used to create 
multiple lightweight tasks. SimPy (http://simpy.sourceforge.net/) is an 
example of this.

However generator functions are most commonly used as a convenient way 
to generate a sequence when the generation involves some saved state.

Kent


More information about the Tutor mailing list