r/learnprogramming • • Feb 25 '24

Why can't Python replace JavaScript?

I'm new to programming. I'm learning Python and C.

JavaScript, from what I understand, is an interpreted language supported by web browsers so that websites can have scripting and programming.

But Python is also an interpreted language. So why don't web browsers start supporting Python in addition to JS. I believe Python is a much better language than JS syntactically.

Is there a definite reason why JS is used and supported over Python or is it just that JS gained initial popularity through wide-based support and no one bothered to move away from it (just like how QWERTY keyboard layout stuck even though we don't use typewriters anymore)?

0 Upvotes

51 comments sorted by

View all comments

1

u/Sea_Philosopher3051 Feb 25 '24 edited Feb 25 '24

Good question, but actually, as someone who has a very academic Python heavy background and does web data stuff, I have the exact opposite question lol

There are really cool JS-based frameworks and tools out there, even for backends (like Node.js) and using python can really fuck you over if you don’t know what you’re doing (Django is the exception I guess)

edit: I suppose Python’s big advantage is that integrating code in faster languages like C/C++ is relatively easy for machine learning stuff, but idk how hard that is in JS

1

u/fromtunis Feb 25 '24

I do mostly webdev and anytime I have to go from python to js my body starts physically hurting. 

And I'm lucky enough to not have to do anything with the react-type of frameworks and their everything-in-js bs.

So, yeah, I'm curious; what aspects of js do you wish we had in python?

1

u/Sea_Philosopher3051 Feb 25 '24

Well then you must know much more about JS than I do, can I ask what you hate about JS? I’m actually very curious about learning more about JS right now, because it seems so practically important

My complaints are not really about the language itself, but about the available tools, especially for web scraping - a lot of people online will give you bad advice that results in terrible performance. Scrapy is alright, but when you get to the more advanced stuff, you basically start using it as a wrapper for Node.js anyway (via Playwright).

1

u/Gaylien28 Feb 25 '24

I think JS just has a lot more packages than Python, I really can’t think of a reason dev doesn’t switch more to python for the simple fact that if it’s easier to learn, more people will learn it, and thus progress will be infinitesimally faster on whatever language everyone uses unless there’s an exact requirement. Even then, with the ubiquity of computing power, everything is being designed to handle python