> Dag Sverre wrote a similar writeup: http://wiki.cython.org/
> enhancements/switch . I think it's a good idea. For small lists the
> savings will be minimal, but for larger ones there can be significant
> gains.
>
I often question switch statements though, I'm actually quite happy that
Guido didn't make them part of Python. Often something like this is more
appropriate:
handlers = {
500: http_ok,
404: http_not_found
}
handlers[retcode](request, response)
Of course, since we are talking performance of the GCC compiler here, I
suppose it's one of the cases where performance for a O(1) operation do
count, and then it's a different matter. All I'm saying is that most
code I see using switch statements would often be better off without it.
*runs and ducks*
--
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev