17.4. Dynamic Module Loading

From time to time, heavily used Python modules are translated to C if using the C version leads to a speed increase. The functionality of the string module, for example, has been reimplemented in C. When Python loads the string module, it checks to see if the optimized version known as strop is available. If it is, the optimized module is loaded instead. All references to the string module will work but will be implemented by the C optimized strop module.

Two other Python modules that have recently been optimized are sgmllib and StringIO. For sgmllib, the optimized module is known as sgmlop. For StringIO, the optimized module is known as cStringIO.

Depending on the platform and the version of Python your scripts are ...

Get XML Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.