[Python-Dev] generator/microthread syntax

Phillip J. Eby pje at telecommunity.com
Tue Nov 18 19:46:51 EST 2003


At 07:42 PM 11/18/03 -0500, Phillip J. Eby wrote:
>     def spawn(self,thread):
>         stack = [thread]
>         threads.append(stack)

Oops.  That should've been 'self.threads.append(stack)'.  Told you it was 
untested.  :)

There's one other bug, too.  The 'while True' loop in the __iter__ method 
really should be 'while self.threads', or else it'll go into an infinite 
loop when all microthreads have terminated.




More information about the Python-Dev mailing list