I use a coroutine/generator framework for simulating concurrent processes.
To do this, I write all my functions using the general form:
while True:
do stuff
yield None
To make these generator functions compatible with a standard thread
interface, I attempted to write a decorator which co
Simon Wittber wrote:
I use a coroutine/generator framework for simulating concurrent processes.
To do this, I write all my functions using the general form:
while True:
do stuff
yield None
To make these generator functions compatible with a standard thread
interface, I attempted to write a
Simon Wittber wrote:
> I use a coroutine/generator framework for simulating concurrent processes.
>
> To do this, I write all my functions using the general form:
>
> while True:
> do stuff
> yield None
>
> To make these generator functions compatible with a standard thread
> interface, I attem
> I'm a little confused as to what you're trying to do here. The f()
> function, in particular, doesn't make much sense
I see I am misunderstood. The example was contrived, and it seems, incorrect.
I simulate threads, using generator functions and a scheduler.
My implementation lives here: http
Simon Wittber wrote:
I guess this changes my question to: Can I convert a function
containing an infinite loop, into a generator which will yield on each
iteration?
Why don't you just use threads? It would probably be easier in the long
run...
--
Timo Virkkala
--
http://mail.python.org/mailman/lis
"Simon Wittber" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I guess this changes my question to: Can I convert a function
> containing an infinite loop, into a generator which will yield on each
> iteration?
A function containing an infinite loop will never return, so it is bug
> 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. T
"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,
Simon Wittber <[EMAIL PROTECTED]> writes:
>> 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 s
> "Mike" == Mike Meyer <[EMAIL PROTECTED]> writes:
Mike> I think it's a bit abnormal, because you have to scan the
Mike> loop body for breaks. I tend to write:
Mike> condition = True
Mike> while condition: # corrected
Mike> #code which iterates my simulation
Then you
Isaac To <[EMAIL PROTECTED]> writes:
>> "Mike" == Mike Meyer <[EMAIL PROTECTED]> writes:
>
> Mike> I think it's a bit abnormal, because you have to scan the
> Mike> loop body for breaks. I tend to write:
>
> Mike> condition = True
> Mike> while condition: # corrected
> Mik
11 matches
Mail list logo