this post was submitted on 16 Sep 2024
224 points (83.5% liked)

Programmer Humor

19821 readers
817 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] UndercoverUlrikHD@programming.dev 45 points 3 months ago (1 children)

The sea should be marked as C considering that's what you'll discover when you get deep into it.

[–] _stranger_@lemmy.world 17 points 3 months ago* (last edited 3 months ago) (1 children)
[–] BatmanAoD@programming.dev 10 points 3 months ago (2 children)

The reason C becomes relevant to Python users isn't typically because the interpreter is written in C, but because so many important libraries (especially numpy) are implemented in C.

[–] _stranger_@lemmy.world 5 points 3 months ago

Oh for sure, and some of those are not ok with swapping the interpreter out 🤣

[–] Corbin@programming.dev 2 points 3 months ago (1 children)

Extension modules are implemented in C because the interpreter is written in C. If it were written in another language, folks would write extension modules for that language instead. Also, it would be less relevant if people used portable C bindings like cffi, which are portable to PyPy and other interpreters… but they don't.

[–] BatmanAoD@programming.dev 0 points 3 months ago

Extension modules can be, and are, written in Rust and C++. And PyPy has a compatibility layer to run extensions (such as numpy) that are written for CPython.

The reason extension modules are typically in C is of course the API is in C, but that's true of cffi as well (though you're right that cffi is more portable). And the reason the API is in C is more fundamental than "CPython is written in C".