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

266

u/K900_ SRE person // please don't DM me your questions Jun 28 '20

It's not about Python being faster or slower, it's about the time it takes you to build something. Python is totally fine, performance wise, for building lots of things. Yes, C can be faster, but you can build a web app in an hour in Python, and it will take you days in C.

33

u/PricePadraic Jun 29 '20

That’s crazy. I have noticed that learning Python as my introduction to programming has definitely spoiled me in a way that is hard to quantify. Now going through a JavaScript course and I keep catching myself thinking... wow this seems like a stupid way of doing this...

52

u/szirith Jun 29 '20

To be fair, JavaScript is pretty stupid.

11

u/keeldude Jun 29 '20

I think it seems stupid at first, but a deep dive into it will reveal many use cases.

7

u/exhuma exhuma Jun 29 '20

I don't write a lot of JS, only a tiny bit for some hobby projects, but clearly JS is an absolutely viable language.

But it requires discipline.

It's not that JS is a stupid language. It's that it let's you do stupid things. And a lot of beginner code is absolutely horrid in JS.

That's not to say that it has no silly corners, like the binding of this is unintuitive. But every language has ugly bits. Even Python.

3

u/szirith Jun 29 '20

Never said it wasn't useful. Just stupid. It is incredibly portable and it's designed like a fucking Jenga Tower.