list-like behaviour of etree.Element

Daniel Nogradi nogradi at gmail.com
Mon Mar 5 04:35:52 EST 2007


> >> The etree.Element (or ElementTree.Element) supports a number of
> >> list-like methods: append, insert, remove. Any special reason why it
> >> doesn't support pop and extend (and maybe count)?
> >
> > Those methods would not be hard to add.  Perhaps, submit a feature
> > request to Fredrik Lundh on SourceForge and see what he thinks there
> > is merit in more closely emulating the list API.  Of the methods you
> > listed, the case is probably strongest for extend().
>
> extend() will be in the next release:
>
>     http://effbot.org/zone/elementtree-changes-13.htm
>
> (lxml.etree already has it, btw).
>
> not sure I see the point of pop() and count().  a successful feature request
> would need to include some really compelling use cases.

Great! I also first thought of extend because that would be really
useful, pop and count just came to mind because they exist for lists.
But if extend will be added that'll already make life easier,
pop/count is probably not that much needed.



More information about the Python-list mailing list