Code that ought to run fast, but can't due to Python limitations.

Paul Rubin http
Sun Jul 5 10:58:13 CEST 2009


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> Okay, we get it. Parsing HTML 5 is a bitch. What's your point? I don't 
> see how a case statement would help you here: you're not dispatching on a 
> value, but running through a series of tests until one passes. 

A case statement switch(x):... into a bunch of constant case labels
would be able to use x as an index into a jump vector, and/or do an
unrolled logarithmic (bisection-like) search through the tests,
instead of a linear search.



More information about the Python-list mailing list