[lxml-dev] Expose _assertHasRoot as part of the API?

Stefan Behnel stefan_ml at behnel.de
Thu Mar 29 20:56:24 CEST 2007



Sidnei da Silva wrote:
> I'm facing an issue here, that if applying a XSLT the resulting
> document is empty, the only way to check that is to call
> _assertHasRoot and catch the AssertionError apparently. Obviously
> catching AssertionError's is not very recommended, specially because
> they tend to not be raised when running with -O. Can we add a public
> API to check if a element tree is empty? Maybe isEmpty()?

Hi Sidnei,

doesn't "tree.getroot() is not None" work for you?

Stefan


More information about the lxml-dev mailing list