
An error will only manifest when actually evaluating the XPath:
...
Note that you won't run into the error when the XPath predicate's not applied i.e. contains() is not even called:
...
So calling with the wrong arg number is an XPath runtime, not an XPath compile time error.
Indeed you wouldn't know if there's an error or not at compile time:
That's what I was asking about: determining at compile time, if practical. We do our XPath lookups inside a browser, but we can read the scripts that provide the XPaths with a Python script. I understand if the lxml devs do not consider this a bug, but it would be helpful for us. I recognize your point about Python having the same behavior, except that the set of XPath 1.0 functions and their arguments are well-defined. -- "The first step in confirming there is a bug in someone else's work is confirming there are no bugs in your own." -- Alexander J. Vincent, June 30, 2001