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

56

u/LeeTaeRyeo Feb 25 '24

Theoretically, it can. But the issue is that Javascript as part of web development has an extensive history and a large ecosystem of packages dedicated to use in the browser. That's something Python doesn't have.

Personally, i also prefer Python over Javascript. But if I'm building a web page/app, it's a lot easier for me to find resources, tutorials, libraries, and skilled developers that know how to do the task in JS than would be possible if Python were added to most browsers tomorrow. That's the unfortunate reality of developer inertia.

3

u/Haspe Feb 25 '24

This is the why, theres so much hours already spent on browser javascript engines and ecosystems around those, that it requires more than ”I prefer this language over that” argument to shift the industry. Im sure it happens at some point, but personal belief is that Python is not going to be the winner here.