pythonccross-platformplatform-independence

How is Python platform independent?


I know that Python is platform independent, but I don't understand how that works for CPython. If the interpreter and some of the modules are written in C, aren't those going to be platform dependent?


Solution

  • C is platform independent in the sense that it can be compiled for any machine for which a compiler is made to target that machine. That's why the Python source code is platform independent, even if a Python binary can only work on one platform.