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

1

u/[deleted] Jun 29 '20
  1. Facebook is written in PHP, but it uses a c++ parser/runtime for critical parts of its application.

  2. Instagram is built using Django, but it also uses c++ runtime to speed up critical parts. Also, I read somewhere that the Instagram server takes up to 40 minutes to restart because of python.

These facts don't make one PL better than others. They are only better in their domain.

  1. You could build literally anything using python

  2. Easy to understand (readability)

  3. Massive open source applications and community support

  4. Currently first in line for Data Science / Machine Learning

  5. Swift is hoping to replace python, It is simple as python but runs faster.

  6. Even though it's insanely fast, Go isn't suited for data science, because it wasn't built that way.

  7. And for those who love c++ very much, Go/Rust will replace it (not very soon). These languages were built to tackle memory problems. Microsoft already has a Rust team working on rewriting some parts of the windows. MS is also building a language inspired by Rust (Project Verona).