[lxml-dev] [lxml][objectify] optimization of recursive object dumping

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Wed Oct 25 19:32:34 CEST 2006


Hi again,

Stefan Behnel wrote:
> On the other hand, what if we did something like this:
> 
>   cdef object _dump(_Element element, int indent):
>     indentstr = "    " * indent
>     if isinstance(element, ObjectifiedDataElement):
>         value = str(element)
>     else:
>         ...

I wrote up a patch that could do the trick. Sadly, it requires a behavioural
change in NumberElement to return repr(value) for str(). Not that beautiful.
I'm just posting it to give you an idea about what looks like a viable
approach to me.

I'll try to get 1.1.2 out tomorrow, so unless I get convinced by then that
this is a sufficiently solid idea, this will have to wait for the next release.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objectify-repr-dump.patch
Type: text/x-patch
Size: 2005 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20061025/4967224d/attachment.bin 


More information about the lxml-dev mailing list