Which native python modules are written in C?

c, python

Solution

Like Gene recommended, the best way is to look at the sources and find out which module are implemented in C.

You can check the `__file__` module's attribute :

>>> import math
>>> print(math.__file__)
/usr/lib/python2.7/lib-dynload/math.so

In this example, it's a `.so` file which has been loaded, therefore this module is implemented in a compiled language (most probably in C).

Problem

I intend to write a small text editor in python. Therefore I need a fast string manipulation/text processing library, which is preferably written in C for performance reasons. How do I know which python modules are written in C under the hood?

Original source