r/learnpython • • Jun 28 '20

Can anyone explain why we use Python

I keep reading people say things like ‘because Python is built on C’ and ‘Python is much slower than C++ or Go’, ‘Thats why those languages are used to make most popular games’. I also see people refer to Python as a ‘machine’ language, etc etc. So... why use python then if you can do things faster with another language? And why is Python so popular if this is the case? Seems like python is easier to understand for me at least and much easier to read, but is there some other benefit I’m not understanding? Sorry if this had been asked before, I can’t find any direct comparison information between Python and other languages.

EDIT: Thanks everyone! I feel a much better understanding of why python is fast in a different way from other languages, saving programming time rather than computing time. Definitely got the answers I was looking for.

Another edit: Great insights all around. Thanks to everyone taking the time to answer! Looks like I need to do some more research on Cython as I see a few people mentioning it for when speed is required.

336 Upvotes

120 comments sorted by

View all comments

40

u/flyingfox12 Jun 28 '20

Some other things that haven't been said here:

Python has lots of modules, you don't need solve as many problems because some one else already has.

Connected to the one above, python has a huge user base, so modules you rely on will be somewhat supported.

Python has a critical mass of users across use cases. So you can jump in to using it whether you're building an IoT device, working as a devops CI/CD specialist, or doing big data analysis with machine learning.

IMO python's biggest issue is GIL, and it's that alone that has stopped it from going further than it already has. That's why Go is a very good language to also work with.

8

u/scrdest Jun 28 '20

GIL is not even a Python problem, it's a CPython interpreter problem. It wouldn't even be a problem if all the attempts rewrites thus far didn't crash and burn. The overhead for the dynamic stuff is unfortunately real no matter the interpreter, though.