class-private considered harmful
David Goodger <[email protected]> Fri, 23 Jul 2004 17:17:36 -0400
| Newsgroups | gmane.comp.web.ht2html.devel |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF9D7A50AE6B12BA079C60AF9 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I'm thinking about reimplementing the Docutils website with ht2html. Having looked at ht2html a bit, I think I see what to do. There are a few places where I'd like to subclass ht2html's default behavior though. For instance, I'd like to put a Google search box in the banner. I still want to use Banner.Banner.get_banner to do it, but much of that class is double-underscore-class-private. Which makes it a royal pain to subclass. What's reason for all this __privacy? I can see that with so many mixin classes, there's a risk of namespace collision. But that's pretty easy to avoid. Any other reason? Any objection to refactoring the guts of ht2html to remove all this __privacy? My first thought is to replace class-private method and attribute names with single-underscore names, qualified with the class name. So Banner.__links becomes Banner._banner_links. Basically what class-privacy does, but in a non-magical form. -- David Goodger <http://python.net/~goodger> --------------enigF9D7A50AE6B12BA079C60AF9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBAYBxrqIPjB1FxosRAtInAJ9q6k329wiruRtYP5Ftiu3Cpn05bwCg0htp dLZRanX1nzpCqguUVM/cbcA= =xTQ4 -----END PGP SIGNATURE----- --------------enigF9D7A50AE6B12BA079C60AF9-- ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click