[Tutor] threads

Kent Johnson kent37 at tds.net
Wed Feb 23 20:26:34 CET 2005


Shitiz Bansal wrote:
> Hi,
> Googling for my problem i found the following page:
> 
> http://gnosis.cx/publish/programming/charming_python_b7.html
> 
> It doesnt make much sense to me.It seems that the
> author is implementing a series of routines rather
> than  running them sumultaneously as threads are
> supposed to do.Am i missing the point?

The point is to maintain a list of independent, resumable 'processes' *without* using threads. It's 
a neat hack on generators.

I suggest you read enough of this link
http://www.python.org/doc/2.2.2/whatsnew/node5.html
to understand what a generator is, then take a look at SimPy which takes the concepts that David 
Mertz is talking about and builds a user-friendly, well-documented simulation package around it.

Kent



More information about the Tutor mailing list