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

Paul Rubin http
Sun Jul 5 05:52:17 EDT 2009


Stefan Behnel <stefan_ml at behnel.de> writes:
> >         # Keep a charbuffer to handle the escapeFlag
> >         if self.contentModelFlag in\
> >           (contentModelFlags["CDATA"], contentModelFlags["RCDATA"]):
> Is the tuple
> 	(contentModelFlags["CDATA"], contentModelFlags["RCDATA"])
> constant? If that is the case, I'd cut it out into a class member ...

I think the main issue for that function comes after that if statement.
There is a multi-way switch on a bunch of different possible character
values.  I do agree with you that the first "if" can also be optimized.



More information about the Python-list mailing list