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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access