It's not easy to say when it is a reasonable decision to write extensions in C/C++. The general rule of thumb could be, never, unless you have no other choice. But this is a very subjective statement that leaves a lot of place for the interpretation of what is not doable in Python. In fact, it is hard to find a thing that cannot be done using pure Python code. Still, there are some problems where extensions may be especially useful by adding the following benefits:
- Bypassing GIL in the CPython threading model
- Improving performance in critical code sections
- Integrating third-party dynamic libraries
- Integrating source code written in different languages
- Creating custom datatypes
Of course, for every such problem, there is usually a viable native Python solution. For example, the core CPython interpreter constraints, such as GIL, can easily be...