Re: [xml] python xpath

Daniel Veillard wrote:

>>__str__ = get_content
>>at line 264
>>What do you think ?
>   Is dumping the content really the right thing to do ? Should __str__
> really act as a serialization mechnism (in which case get_content or
> serialize is the right handler) or rather as a debug mechanism (in
> which case the type of the node sounds more important than it serialization).

well, this could get arbitrarily complex, while I was only thinking of
a little convenience...
Everything is already in place, people can get the type, name, etc.
via a simple attribute. I wouldn't expect 'print node' to be used in
anything but debugging code.

>   Also note that get_content() will return the string value of the
> full subtree, is that really useful ?

yeah, I noticed. Hmm, may be it's not that useful after all. May be
it's better not to define a custom __str__ function than to overengineer
something users can get equally simply via existing methods.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]