Re: Pythonicity of some algorithms

2008-05-10 Thread castironpi
On May 10, 5:21 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > This works for me. But I'd like to know if this is considered > > Pythonic, and if there are other, better ways of doing the above in > > Python. > > From the Python point of view, it's fine. However, it uses busy-wait, > which I

Re: Pythonicity of some algorithms

2008-05-10 Thread Martin v. Löwis
> This works for me. But I'd like to know if this is considered > Pythonic, and if there are other, better ways of doing the above in > Python. >From the Python point of view, it's fine. However, it uses busy-wait, which I consider bad style (in any language). > 3) Make a custom thread-safe queue

Pythonicity of some algorithms

2008-05-10 Thread David
Hi list. I have 2 questions about the Pythonicity of some algorithms. One question is about generator usage, the other is about producer and consumer threads GENERATOR QUESTION Usually for generators, the usage is like this: for var in generator(): do_something(var) I sometimes have cases