"Simon Wittber" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 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.

Yes, quite normal.  This is Python's version of do...until, synthesized 
from while and break.  As most people use the term, this is *not* 
structurally an infinite loop (meaning no break) and also not functionally 
so unless the condition is such that it never breaks either for some or all 
inputs to the function.

> 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.

One Python level approach would be to quote the text of the function defs 
that need to switch and then either programmatically edit them or not 
before exec-ing them.  Also messy, but more robust against version and 
implementation changes.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to