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

Paul Rubin http
Sat Jul 4 14:40:19 EDT 2009


John Nagle <nagle at animats.com> writes:
> Python doesn't have a "switch" or "case" statement, and when
> you need a state machine with many states, that makes for painful,
> slow code.  ...
> There's a comment in the code that it would be useful
> to run a few billion lines of HTML through an instrumented version
> of the parser to decide in which order the IF statements should be
> executed.  You shouldn't have to do that.

In that particular program it would probably be better to change those
if/elif/elif/else constructs to dictionary lookups.  I see the program
already does that for some large tables.




More information about the Python-list mailing list