[lxml-dev] Renaming the drop_*() methods

Ian Bicking ianb at colorstudy.com
Wed Jun 13 23:55:01 CEST 2007


Stefan Behnel wrote:
> 
> Stefan Behnel wrote:
>> Ian Bicking wrote:
>>> Incidentally, someone asked for a drop_tree method in another context,
>>> and maybe it makes sense in more than just HTML.  It's a tricky method
>>> to get right, in that you can do it lazily and get it wrong (e.g.,
>>> assume the element doesn't have a tail, or assume it does and it's not
>>> None, or that the element really has a previous sibling, or doesn't).
>> Right. But what about helper *functions* then instead? They could work on any
>> element, not just on those that define them as methods.
> 
> Ah, I knew I wasn't the first one who had that idea... :)
> 
> http://effbot.org/zone/element-lib.htm
> http://effbot.org/zone/element-bits-and-pieces.htm
> 
> I think we should try to get back in touch with FL to see if we can't get
> something compatible out of this. Haven't heard of him in a while, though.

This was kind of what I was putting together originally in lxml.html, 
until I moved everything into the HtmlElement subclass.  Having done 
that I now prefer the methods over the functions.

   Ian


More information about the lxml-dev mailing list