[lxml-dev] find/findall not accepting qnames?

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Fri Dec 1 09:27:02 CET 2006


Hi,

John Krukoff wrote:
> I find it surprising that find & findall do not accept QName objects in
> lxml

True, that's about the only place where we do not parse the input ourselves
but hand it to the ElementPath module of ElementTree. All other places use the
same function for parsing tag names, so that makes QNames completely
transparent in lxml.

I agree that this is unexpected behaviour and since we accept QNames in loads
of other places, we should make it a special case if a QName is passed as path
to find*(). After all, it's a common use case to look for a specific tag
instead of a path.

BTW, using getiterator(tag) for this purpose should be a bit faster.

Stefan


More information about the lxml-dev mailing list