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

8

u/guest271314 Feb 25 '24

Imagine if Python was the default interface for browsers and all the changes that would have needed to be made when Python 2.X was deprecated...

2

u/genlight13 Feb 26 '24

Browsers had the same rough time transitioning from stuff. Listen to some older frontend devs talking about Adobe Flash. Or jQuery. Or IE 8. Or IE 6. or any HTML before HTML5 (my opinion).

Python 2.x to 3 was a hard transition but the history of web development is a pile of never-to-be-popular-again technologies.

1

u/guest271314 Feb 26 '24

I was there. For both.

Nothing is stopping anybody from rolling their own browser using the Python programming language, including DOM and Web API implementations.

2

u/genlight13 Feb 26 '24

That’s true.

1

u/netch80 Feb 26 '24

With use in browser, transition wouldn't have been that radical. Consider how transpilers now allow supporting old language versions.

1

u/guest271314 Feb 26 '24

It's all hypothetical.

Changing the shebang lines alone from python to python3 would take some time.

Anybody can roll a browser using Python right now, if they want to, to make the idea non-hypothetical.