[Zope-Coders] x.startswith() vs. x[ ..]
Chris Withers
chrisw@nipltd.com
Tue, 04 Dec 2001 12:23:58 +0000
"Fred L. Drake, Jr." wrote:
>
> ----------------------------------------------------------------------
> def _contains_at(s, sub, pos):
> return s.startswith(sub, pos)
> ----------------------------------------------------------------------
Cool...
> Changing the calls to _contains_at() to use startwith() directly
> would be a more significant improvement since we get rid of the calls
> to a Python function entirely, but make it harder to maintain
> compatibility with Python 1.5.2.
Hmmm :-(
> Be aware that any changes to HTMLParser would only help the time
> required to *compile* a Page Template; there would be no change to the
> time taken to render the template.
Not all of us use HTMLParser for Page Templates, it's part of the Python
Standard Library now ;-)
...and that version should definitely make use of these enhancements.
Come to think of it, Page Templates on the Zope 3 branch probably shouldn't
include HTMLParser.py at all and should just use the one in the python standard
library...
cheers,
Chris