There are functions such as print
that are embedded in CPython and there are other functions such as os.makedirs
that are written in external .py files (i.e. in os.py
).
As far as I know, print()
would call some C code that is already written inside CPython and that C code would be compiled to bytecode to be understood by the computer.
What happens in the case of os.makedirs
? That is not embedded in CPython so CPython doesn't know anything about os.makedirs
.
Or is makedirs
making use of some objects that can be traced back to built-in objects that CPython knows about?
For example, os.py
imports abc.py
which imports _weakrefset.py
which eventually imports the builtin _weakref
object? So, os.py
can be traced to the builtin _weakref
object, for which, CPython has some C code.