[lxml-dev] merge annotate() and xsiannotate() into single function
Stefan Behnel
stefan_ml at behnel.de
Fri Jun 22 18:01:39 CEST 2007
Hi Holger,
jholg at gmx.de wrote:
>>> Holger, could you look through it to check if this is what you would
>>> expect? I know that it does not guarantee exactly the same behaviour as
>>> before, so there will likely be cases where some annotations come out
>>> different than now.
>> I'll look into it.
>
> I haven't had time to test thoroughly but that eems pretty much to do
> everything I'd expect. I like the empty_pytype switch.
>
> Two things: -I think the order of the 2 first checks if the old xsi:type or
> py:pytype hints should be reused should be changed to first look at old
> py:pytype; this is more like annotate() worked until now
I considered that, but the thing is that xsi:type is a more accurate
description of the type, so I think it should be preferred. Note that there is
still a type check involved, so if the old one doesn't work, the possibly
broader pytype is considered next.
> -I'd like to keep TREE attribute info for *leaf* tree elements if
> ignore_old is False, so that a full annotate->serialize->re-parse cycle has
> a chance of keeping these elements ObjectifiedElements.
Then how would you get rid of those if you wanted to?
> And I think you could also let _annotate have a public interface, to let
> the bold-at-heart xsi-and-pytype-annotate in one step.
That's why I noted that xsiannotate was never part of an official release.
Maybe we should just remove it and extend annotate() instead.
> I'd volunteer to add/adapt all tests for annotate/xsiannotate and maybe
> introduce the afore mentioned small changes, but that won't be until next
> week.
That's ok, I'll have to look into the crashes anyway before 1.3 goes for world
domination.
> And why should xsiannotate() not go into 1.3, btw? It doesn't look like it
> needs to change behaviour for 2.0, any more :)
As I said, I'd prefer having a single function here, just as with deannotate().
Stefan
More information about the lxml-dev
mailing list