Fredrik Lundh schrieb:
> Diez B. Roggisch wrote:
> 
>  > No doubt that changing the flag asynchronously is a gain by delegating
>  > the timing code to the OS. Yet the while loop still has a condition -
>  > you could as well set a flag in the signal handler an do it like this:
> 
> if the OP is obsessed with performance, why are you arguing that he 
> "could as well" use a slower solution ?

Maybe because it is the better solution in case of anything that has 
more than one line of work to do? The Exception can interrupt 
everywhere, the flag determines the point of interruption precisely.

>> This is on my machine about 1.5 times slower than func1, but much more 
>> readable 
> 
> polling a global state flag being "much more readable" than handling an 
> exception in the usual way?  surely you're joking.
> 
> are you sure you're posted the code you're writing about, btw.  that "or 
> True" looks a bit suspicious.

Yeah, that should have been a False - I added that after copying a first 
version without that, instead of replacing it with the modified original 
that I created to see what impact the short-circuiting "or" had.

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

Reply via email to