by takeda · 3y ago · 0 comments
I think here is your problem. You're expecting dynamically typed, interpreted language to be comparable to statically typed compiled language.
Python is best used as a glue language, or when performance is not critical.
That doesn't mean you can't have fast code with python. I for example was able to encode a live video into using x264 then steam it over the Internet in python, then on the other side receive the data, decode and display it.
Though the encoding/decoding was done by a C code that was interacted with through python package.
I suppose I could have the whole thing done in C, but then my code would be more complex and longer. It will also be harder to iterate on it.
But C-extensions don't require the small speedups and additional interpreter complexity that this project brings.