yes, not a unix os but rather unix-like, and i want to program all of it on python, is that possible?? even the kernel, i want it all python. i know most kernels use c++ or c* but maybe python has a library to turn c* into python?? i’m still sort of a beginner but thanks and i would appreciate the answers

    • Jiří Král
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      18 hours ago

      Can’t Python be translated into machine code and packaged into a binary? I swear I have no experience in OS development, just curious.

      • litchralee@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        7 hours ago

        Can’t Python be translated into machine code

        Yes, and that’s basically what the CPython interpreter does when you call a Python script. It sometimes even leaves the machine code laying in your filesystem, with the extension .pyc . This is the byte code (aka machine code) for CPython’s implementation of the Python Virtual Machine (PVM).

        and packaged into a binary?

        Almost. The .pyc file is meant to run with the appropriate PVM, not for x86 or ARM64, for example. But if you did copy that .pyc to another computer that has a CPython PVM, then you can run that byte code and the Python code should work.

        To create an actual x86 or ARM64 binary, you might use a Python compiler like cython, which compiles to x86 or ARM64 by first translating to C, and then compiling that. The result is a very inefficient and slow binary, but it is functional. You probably shouldn’t do this though.

      • deegeese@sopuli.xyz
        link
        fedilink
        arrow-up
        6
        ·
        17 hours ago

        Like Java, you can distribute a binary which bundles an interpreter/VM, but your code is still running inside a host OS.