By doing so, the new test function is already registered with the empty namespace prefix, that means you can use it like this:

root.xpath("//*[test(., 'arg1', 'arg2')]")

Unfortunately the function that is called for "{http://exslt.org/regular-expressions}test" isn't available from python, only from within the lxml extension implemented in C, so you can't simply assign it to functionNS['test'].

That means you'd need to reimplement it in python to assign it to the empty function namespace...

If that's not worth the trouble for you to spare you typing three characters, you could use this trick to make the re prefix for the namespace global: