On 4/3/07, Sean McAfee <[EMAIL PROTECTED]> wrote:
So, not much interest has been expressed in my proposal so far--not surprisingly, since I imagine this audience doesn't include many regular Python users. I wish I wasn't one myself. However, I still think a Python implementation for the Template Toolkit would be a great thing to have. The TT's power blows away any Python templating system I've ever encountered.
I started a Python port of TT about three, maybe four years ago. Andy and I discussed hosting it alongside the Perl source tree, but I didn't get very far with it. You didn't mention what you're using to generate the Template.Grammar class, but I took the approach of starting with the Perl grammar (parser/Parser.yp), modifying the productions to be Python instead of Perl, and then making a Grammar.py.skel to hold the code. I considered using something other than YAPP to build the grammar, but keeping the grammar the same between two different parser generators wasn't something I wanted to think about, and I liked being able to compare the Perl and Python versions side by side and see the exact differences. All the native Python parser generators I saw did all their work at runtime, and I think building a static grammar module (the way Template::Grammar is built) is the Right Way to do it; The TT grammar is not small, and building it dynamically when the grammar module is loaded seems very wasteful to me. (Python is slow enough as it is!) As far as generating the grammar statically: The problem is the whitespace. Normally it doesn't bother me (I can even see how it could be construed as a feature), but it makes generating Python code artificially difficult. I think there would have been a definite niche for it a few years ago, but at this point there are a few template libraries for Python that are popular, and usable, if not ideal. I don't use Python much anymore, myself, so I can't say that I would need to use it now, but I would have killed for a complete TT implementation in Python a few years ago (I was part of a team that built a massive Zope product a few years ago, and I lost much time and sanity to ZPT, but I've done very little with Python since then). Has you gotten opinions on this from anyone in the python community? Are there any prospective users? -- (darren) _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
