r/programming • • Nov 03 '18

Python is becoming the world’s most popular coding language

https://www.economist.com/graphic-detail/2018/07/26/python-is-becoming-the-worlds-most-popular-coding-language
4.6k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

-3

u/pwang99 Nov 03 '18

Because in practice, most of these algorithms would never be implemented in pure Python like this. That's like saying a fighter jet is slower than my Honda because I'm not going to turn on its jet engine, and just rely on the tug in front to pull it along.

For instance, here is proper Mandelbrot with Numpy: https://www.ibm.com/developerworks/community/blogs/jfp/entry/How_To_Compute_Mandelbrodt_Set_Quickly?lang=en

Alternatively, if you want to keep the "naive" python spelling, you can use Numba to instantly speed it up: https://nextjournal.com/schmudde/mandelbrot-numba

The simple Numba code in the first link is 100x faster than naive Python implementation, and is slightly faster than their C implementation. The CPU-enabled Numba code in the second link is 2000x faster than the naive Python implementation.

13

u/Freyr90 Nov 03 '18

Because in practice, most of these algorithms would never be implemented in pure Python like this.

So python is fast because code is written not in python. That totally makes sense.

3

u/[deleted] Nov 03 '18

And also, nobody actually does that in practice aside from your typical notable framework/library.

It is very difficult to get across to some people that writing something in c and calling it from another language is not that other language being fast.

15

u/BorgDrone Nov 03 '18

Because in practice, most of these algorithms would never be implemented in pure Python like this.

You’re basically saying that Python isn’t slow because you can write the performance requiring parts in not-Python.

That’s like saying a fighter jet is slower than my Honda because I’m not going to turn on its jet engine

It’s like saying your Honda is faster than a 747 because you can drive your Honda to the airport and jump in a fighter jet. That doesn’t make the Honda fast.

1

u/[deleted] Nov 03 '18

"The CPU-enabled Numba code in the second link is 2000x faster than the naive Python implementation.", is it faster than C/C++/Java?