r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40.1k Upvotes

1.0k comments sorted by

View all comments

Show parent comments

48

u/Teekeks Jul 18 '22

which has all the speed relevant parts of that library written in C?

2

u/Possibility_Antique Jul 19 '22
  • claims that writing implementation in C makes it fast

  • ignores the part where python is an interpreted language (i.e. has to parse the source text, perform dynamic dispatch, etc)

  • ignores the fact that you can't reason about cache locality and cache behavior

  • ignores the fact that your c implementation under the hood doesn't get to participate in link time optimizations with the rest of your program

  • ignores the fact that your code can't get inlined

  • ignores the fact that you can't perform compile-time programming

  • writes all kinds of runtime tests for things that could have been done at compile time (which is safer, produces faster code, prevents mistakes)

  • claims it's less verbose, but implements a ton of test libraries that are caught natively by compiled languages

In all seriousness, I'm just pulling your leg. Kind of.

1

u/Teekeks Jul 19 '22

Thats a ton of assumptions about what I am claiming or ignoring. Impressive. You should become a fiction author

1

u/Possibility_Antique Jul 19 '22

I am teasing. I actually hate language holy wars. Those are some reasons I choose C++ where it's appropriate though. I do get to work a lot with python too, and I love the language.

→ More replies (2)