Pythonicity of some algorithms

castironpi at gmail.com castironpi at gmail.com
Sat May 10 07:53:52 EDT 2008


On May 10, 5:21 am, "Martin v. Löwis" <mar... at v.loewis.de> 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 consider bad style (in any language).
>
> > 3) Make a custom thread-safe queue class, with an 'interrupt_get'
> > method. When your app calls queue.interrupt_get(), all threads
> > currently locking on a queue.get() will continue, but with a
> > GetInterrupted exception thrown.
>
> That's what I would do. I'd use the existing Queue class as a base
> class, though, rather than starting from scratch.
>
> Regards,
> Martin

Did you follow the links to Dev-C++?  It rules house.  I have
drizzle.c compiling in Windows GDI and SDL.  I'm poised to double-time
Dev-C++ and Windows GDI, if double-tasking is on the market.  Credit
up... what's standard?



More information about the Python-list mailing list