[Cython] XSLT based optimisation
Robert Bradshaw
robertwb at math.washington.edu
Mon Mar 10 18:11:58 CET 2008
On Mar 9, 2008, at 5:40 AM, Stefan Behnel wrote:
> Hi,
>
> Robert Bradshaw wrote:
>> Speaking specifically of XSLT, in your framework it would be possible
>> to write a Transform that dumps out the tree as XML (like your
>> printer, but fancier), runs some XSLT on it, then reads it back in.
>> Most of my personal experience with XML has been unimpressive
>> (usually 'cause it's way to bloated of a tool than needed for the
>> task at hand, and slow).
>
> Hmm, slow, is it? Tried lxml lately?
:-). No, actually most of my excursions into XML were a long time
ago, with Java and PHP, and for tasks better suited to a SQL database
rather than a huge XML file. Being the wrong tool for the job left a
bad taste in my mouth, but that's not the fault (I'm willing to
believe) of XML.
> It's actually a funny idea to optimise code with a tool that is
> itself written
> in the compiled language. That way, lxml would basically optimise
> itself. :)
>
> Also, you could easily represent the parse tree in custom classes
> in lxml
> (although not the ones that Cython currently uses). And, lxml now has
> XSLT extension elements, meaning, you can write your own XSLT
> commands in
> Python and do stuff that you can't do in XSLT in plain Python code,
> like
> calculating static expressions, for example. How is that for a tool?
If we decide to use XML/XSLT, lxml certainly seems like the fitting
tool :).
- Robert
More information about the Cython-dev
mailing list