r/ProgrammerAnimemes • • May 29 '22

Fixed that certain meme about python

Post image
1.1k Upvotes

59 comments sorted by

View all comments

Show parent comment

1

u/[deleted] May 31 '22

Because you really should be avoiding C as much as you possibly can unless it's legitimately required by your use-case.

2

u/Mast3r_waf1z May 31 '22

What? Care to elaborate on that? I believe there is a reason why the linux kernel for example isn't written in python despite being possible

1

u/[deleted] Jun 01 '22 edited Jun 01 '22

C is not a good language in a number of ways, many of which are due to performance and resources constraints in the context of its original creation. Its design is not conducive to writing secure or high-reliability software, and any such software written in it is done in spite of its design flaws (and because network effect has made it so that for some platforms proprietary C compilers are the only vendor-provided compilers available at all - so even now you need something that you can at least cross-compile to C to write for them).

Python is an interpreted scripting language, which is generally too slow to reasonably write a useful kernel with (you really want native binaries), it also lacks a certain level of low level access that can be useful in writing an OS. But most importantly, Python lacks a stable standard you can rely on to write your OS, so you're basically relying on some arbitrary canonical implementation that provides you with no long-term guarantees (and it has done many breaking changes in minor version changes, I've had to deal with them at work). Python was [very new](https://en.wikipedia.org/wiki/Python_(programming_language)#History) and unstable when Linux was first created. C++ likewise lacked a standard back then.

Ada. But that would also ignore why C was created to start with.

edit: The importance of that network effect (and thereby portability) is also part of why projects like seL4 bother with writing their microkernel in C despite the fact they really wanted to do it in ML (iirc).