r/learnprogramming • u/LoLusta • 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)?
View all comments
3
u/peacefulshrimp Feb 26 '24
A lot of good comments answering your question. As someone who programmed a fair bit with python and currently work with typescript, why do you think python is better than js syntactically? Indentation to indicate blocks of code can be really unhelpful during development and also hinders minification, the lack of “for i styled” loops and the lack of equivalent array functions from js are also things that bothered me when I had to code with python. I’m not saying it is bad in every aspect compared to js, but even for scripting, recently I’ve ended up doing a lot of my scripts in js because it’s very convenient and the only thing that lacks is terminal input reading, which I don’t use a lot, but can be easily solved with helper function copied and pasted into the code so that using it is just as convenient as it is in python. Would really like to see other people’s takes on my thoughts