Re: issues with doctest and threads

2005-08-10 Thread Michele Simionato
Tim Peters wrote: > Because the program is buggy: synchronizing threads isn't a "do it if > you feel like it" thing, it's essential to correct threaded behavior. > If you're going to show students bad thread practice, they're going to > get mysteries a lot deeper and more damaging than this one <0

Re: issues with doctest and threads

2005-08-09 Thread Tim Peters
[Michele Simionato] > Thank you for your replies Jeff & Tim. The snippet I submitted is > unfortunate, since I was writing an example (for a Python course I am > going to give in September) to show that you cannot reliably assume > that you will get exactly 9 dots, because of the limitations of 'sl

Re: issues with doctest and threads

2005-08-09 Thread Michele Simionato
Thank you for your replies Jeff & Tim. The snippet I submitted is unfortunate, since I was writing an example (for a Python course I am going to give in September) to show that you cannot reliably assume that you will get exactly 9 dots, because of the limitations of 'sleep'. Mindlessly, I have cut

Re: issues with doctest and threads

2005-08-08 Thread Tim Peters
[Michele Simionato] > I am getting a strange error with this script: > > $ cat doctest-threads.py > """ > >>> import time, threading > >>> def example(): > ... thread.out = [] > ... while thread.running: > ... time.sleep(.01) > ... thread.out.append(".") > >>> thread = threa

Re: issues with doctest and threads

2005-08-08 Thread jepler
I don't see the problem with your doctest usage, but what makes you believe that the code you show below produces exactly 9 dots? strangely enough, re-working the code to this >>> import time, threading >>> def example(): ... thread.out = [] ... for i in range(9): thread.out.append(".") >>

issues with doctest and threads

2005-08-08 Thread Michele Simionato
I am getting a strange error with this script: $ cat doctest-threads.py """ >>> import time, threading >>> def example(): ... thread.out = [] ... while thread.running: ... time.sleep(.01) ... thread.out.append(".") >>> thread = threading.Thread(None, example) >>> thread.run