[lxml-dev] ElementTree.find does not accept QName objects.

Stefan Behnel stefan_ml at behnel.de
Sun Apr 6 16:20:18 CEST 2008



John Krukoff wrote:
> It looks like it only works when ET.find has already been called with
> the string value of the same name that a following QName find specifies.
> Some internal caching, perhaps?

There is an internal cache in ElementPath.py that might cut in here.


> In any case, it does look like accepting QNames at all is a bug in ET,
> or at least an accident. Don't know what that means for lxml, but it
> would seem to me that strict compatibility would mean that find should
> be restricted to strings.

I think it's right to accept QName objects wherever tag names are accepted. So
it's ET that's wrong here.

Stefan



More information about the lxml-dev mailing list