I tested this program with saving as and running it via


and it ends with 30 as largest print number.

So that it keeps running within idle should be considered a "bug" of IDLE :)

In addition:
# A simpe program to test compilation of threads

class TTest( threading.Thread):
    kbh = threading.Lock()

I guess you do not want to do this. With defining "threadid" on this level it is a class-attribute, that ist: thread1 and thread2 do share it.

if __name__=="__main__":
    thread1.start ()

threading is a beast :) But as much as I understand: after finishing "thread2.start()", the program is over. You have no sustainable main thread.

if you add something like

import time

your programm wil run for roughly 60 seconds.

So, what I am trying to say: no mainthread, programm ends.


GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstra├če 202b
70197 Stuttgart
PostgreSQL - supported by a community that does not put you on hold