durusmail: qp: Re: Subclassing u8, h8
Subclassing u8, h8
2007-09-17
Re: Subclassing u8, h8
2007-09-17
2007-09-18
2007-09-18
Re: Subclassing u8, h8
Michael Watkins
2007-09-18
* David Binger wrote on [2007-09-17 20:45:24 -0400]:
> as I have been thinking about what qpy should become in python 3,

Yay!

> I'm thinking of a new class named "html" to replace h8, and using
> python3's str class directly instead of defining any separate
> u8-type class.  I'm also thinking of changing the templates to
> allow [str] instead of [plain] as the distinguishing mark.

That might help remove any possible confusion.

> Should the new html class be written (in C) specifically to be
> subclass-able?  The cost is that html-combining operations, which
> may be executed at a very high frequency in common applications,
> will be slower.  I'm not sure.

+1 on speed over subclassing convenience is my gut reaction since
the primary use case is as you note - many combining operations.

I also note py3k string performance compared to 2.5.1 is anywhere
from 5x - 8x slower for '%s' % arg style substitutions; 10+x slower for
the new '{0}'.format(arg) style.

py3k .format() type operation is about on par with h8('%s') % arg,
so perhaps we won't really notice much of a change. And perhaps
string performance will be subject to a pre 1.0 release
need-for-speed event too.

reply