creating generators from function

Simon Wittber simonwittber at gmail.com
Wed Dec 8 20:14:32 EST 2004


> A function containing an infinite loop will never return, so it is bugged
> and useless unless it does has an external effect with something like
> 'print xxx' within the loop.  

I thought the idiom:

while True:
    #code which iterates my simulation
    if condition: break

wat quite normal. This is the style loop I am using. 

> Note 2. Delving deep into CPython internals, as you are, is CPython hacking
> rather than Python programming per se. Fun, maybe, but I wonder if this is
> really to best way to do what you want to do.

I am trying to allow two modes of concurrency, (threading, and
pseudo-threading using generators) without having to change my
application code. If either CPython or Python hacking can provide a
solution, I'm not sure, but I would be happy with either.

Sw.



More information about the Python-list mailing list