Why can I reuse XSLT stylesheets in other threads?
Since lxml 2.0, you can. However, it is a lot more efficient to use stylesheets in the thread that created them. This is due to some interfering optimisations in libxslt and lxml.etree. It is therefore a good idea to cache them in thread local storage (see Python’s threading module). lxml cannot easily do this for you, as it cannot know when to discard them from such a cache. If you use very complex stylesheets or create stylesheets programmatically, you should do so in the main thread, and then copy them into the thread cache using the copy module from the standard library.
Since lxml 2.0, you can. However, it is a lot more efficient to use stylesheets in the thread that created them. This is due to some interfering optimisations in libxslt and lxml.etree. It is therefore a good idea to cache them in thread local storage (see Python’s threading module). lxml cannot easily do this for you, as it cannot know when to discard them from such a cache. If you use very complex stylesheets or create stylesheets programmatically, you should do so in the main thread, and then copy them into the thread cache using the copy module from the standard library.