[Edu-sig] Simple example involving threads and infinite loops.

Andre Roberge andre.roberge at gmail.com
Wed Jul 18 00:08:42 CEST 2007


For those that happen to have downloaded Crunchy (version 0.9x), I
have posted a very simple example[1] that illustrate some properties
of threads, and possible interactions between them.

http://crunchypython.blogspot.com/2007/07/unending-loops-and-magic-of-threads.html

The idea of threads is something that should be accessible to anyone
familiar with using a computer.  However, I can not think of a simpler
example in any Python environment to demonstrate
1. How threads can allow different parts of a program to work
independently - in this case, two different Python interpreters.
2. How interactions between threads make certain things (like breaking
of an infinite loop) possible which would not be using a single
thread.

Of course, the user has to take the teacher's word (or mine) for it
when it is stated that the two Python interpreters are running in
separate threads.

André

[1]... and, as is often the case, this example has uncovered a "small"
bug with Crunchy which you might get to see...


More information about the Edu-sig mailing list