Hi. I'm trying to understand the python standard library modules. Seems that some are written in C and others are written in python? How does that work? How did they decide which is which. And also, what if you want to extend a built in python class that is written in C? How is a class even created in C which is not an OOP language? I know that's a lot of questions, but thanks if you can help me understand.
Edit: Also, I can find certain modules like os by looking in the directory /usr/lib/python3.9 (I'm on linux). The os module is in that directory named os.py. But I can't find others like for example the sys module, which I believe is written in C. Where can I find that?
Videos
Although calling c++ libs from python is more normal - you can call a python module from c++ by bascially calling the python intepreter and have it execute the python source. This is called embedding
Alternatively the boost.python library makes it very easy.
You can also try the Boost.Python library; which has this capability. This library is mainly used to expose C++ to Python, but can be used the other way around.