r/Python • • Nov 13 '20

News Python swallows Java to become second-most popular programming language

https://www.theregister.com/2020/11/12/python_swallows_java_to_become/
2.3k Upvotes

205 comments sorted by

View all comments

0

u/[deleted] Nov 13 '20

[deleted]

114

u/[deleted] Nov 13 '20

Better performance?¯_(ツ)_/¯

20

u/gregy521 Nov 13 '20

You can swap CPython with pypy for an average 4x speedup. You can also offload to more efficient libraries like numpy for data crunching, or use Numba to JIT compile to machine code.

→ More replies (2)

25

u/JoelMahon Nov 13 '20

Just need to write something to turn python code into optimised c++ then, ez pz

Tbh, a human can do that part usually quite quickly, use python to invent, c++ for real time critical deliverables after python proves the concept

21

u/Darksteel213 Nov 13 '20

Cython exists, but then you have to specifically write your code to be compiled near 100% to C

10

u/ItsOkILoveYouMYbb Nov 13 '20

I could imagine indie game development taking off even more so than it already has if Python was usable with Unity and Unreal Engine.

Maybe we'll get a speed-critical but pleasant coding language like Python to make modern games with some day.

14

u/jabela Nov 13 '20

Godot has a Python like scripting system. It's definitely getting there.

→ More replies (1)

7

u/gregy521 Nov 13 '20

I believe that's the niche that Rust is trying to fill. Consistently ranked near the top in developer surveys, and runs as fast (or faster) as C/C++ in many cases.

Certainly not 'pleasant' in the way that python is, where it's like writing pseudocode and it has lots of high level features to make life easier, but much more pleasant than C/C++ I would argue.

2

u/SlappinThatBass Nov 13 '20

With pyo3, unlimited power!!! In the future

→ More replies (1)

5

u/xigoi Nov 13 '20

You can't do that because of eval() and friends.

→ More replies (2)

1

u/asbox Nov 13 '20

Exactly that!..don't get why people don't understand how much efficient it is to work this way instead of other freaking languages complications.. Cpp + python is all you need.

6

u/PooPooDooDoo Nov 13 '20

Honestly, if I am going for performance at scale, I wouldn’t chose python. If I am write code that interfaces with other systems that do the heavy lifting, then I am 100% using python.

But yeah, it would be nice.

4

u/jebk Nov 13 '20

As an advanced amateur python user I think most people looking at python Vs say go is the ease of concurrency for stuff.

I imagine what most people searching 'how to make python faster' are lookjng for is 'how to make these 10 huge datasets load faster'.

Multi threading/async stuff isn't as obvious as in something like go (or even node).

1

u/f16f4 Nov 14 '20

Python is terrible for multithreading. It only actually works on one thread at a time because of the GIL.

0

u/[deleted] Nov 13 '20

[deleted]

10

u/gregy521 Nov 13 '20

But if you're running that app 1000 times a day, that sums to 30 and 200 seconds respectively. A much more appreciable difference.

Python is an extremely popular scientific computing language, too, and those don't care about 'every nanosecond', more the fact that cutting the runtime from 4 hours to 20 minutes is worthwhile.

0

u/[deleted] Nov 13 '20

[deleted]

→ More replies (1)

3

u/psharpep Nov 13 '20

Sure, but if you'rr doing scientific computing in Python, you're using NumPy/Numba or similar, which gives runtimes on the order of C.

→ More replies (3)

-1

u/daravenrk Nov 13 '20

But the backend is mostly c. It’s pretty fast.

4

u/[deleted] Nov 13 '20

Oh sweet summer child...

→ More replies (1)