DEV Community

Discussion on: Pitch me on Python

Collapse
 
bascodes profile image
Bas Steins

Python is maybe one of the most versatile language out there. Now you can even do web frontends with it:

Collapse
 
k_penguin_sato profile image
K-Sato

Why not just use JS...?

Collapse
 
tusharsadhwani profile image
Tushar Sadhwani

Because JS is a badly designed language with many pitfalls?
TS is alright, but Python is still way better.

Thread Thread
 
codingjlu profile image
codingjlu

Wait, the "problem" TS solves is implementing static type checking, but there's no type checking in Python, so I'm not sure where you're coming from. Besides that, could you tell me some of the pitfalls you (or you've heard others) encounter when trying to JavaScript? What parts of it do you think are bad designed? I've worked with JS for a long time, and I love Rust, but I like JS even better. For me, Python is way down there next to PHP. And yes, JavaScript, in my opinion, is the best language out there (even ML).

Thread Thread
 
tusharsadhwani profile image
Tushar Sadhwani • Edited

Python has type checking support (in a way that Javascript is planning to add now, there was a TC39 proposal for it this year)

Consider properly trying python then I guess, don't know what else to say.

Ref: tshr.me/mypy

I guess Javascript also has a way to do type checking (jsdoc), but it's awful to write imo.
Apart from that, the weak typing (any data type can turn into strings if you use the wrong operator), the weird rules about how == works, and the baggage of es3 and older standards (eg. array.sort() doesn't do what you'd expect) is enough for me to hate the language as it is.

Thread Thread
 
codingjlu profile image
codingjlu • Edited

Well, I guess it comes to how experienced you are with each language. I've never had any problems with anything you mentioned in JavaScript, so it's probably specific to how much you learned (although I've seen SO posts where people completely crash everything). Sure, JavaScript has its quirks, but I've learned how to avoid the hectic ones and love the others. Python, on the other hand isn't the strange behavior, but more about its misuse (beginner usage—someone made a brute force password guesser in Python), abuse, and overuse that makes me slightly despise it. For me, too, I've never struggled with the untyped language JavaScript, it works perfectly for me. Let me also ask, do you actually use mypy?

Thread Thread
 
tusharsadhwani profile image
Tushar Sadhwani

Javascript is much more misused (given that it's even more popular with beginners), you probably just haven't found the cases :P

I do use mypy, on every project I work on personally and at my workplace.

Thread Thread
 
codingjlu profile image
codingjlu

Okay, good for you.

Collapse
 
lucidmach profile image
Nukala Suraj

JavaScript is maybe one of the most versatile languages out there. Now you can even do machine learning with it:
tensorflow.org/js

😂😁

Collapse
 
codingjlu profile image
codingjlu

But like why?? I'll understand if people try to Rustify JavaScript: it's faster, more efficient, and safer. But Python? Please, no. PyScript is just really really really ugh. I can't see how it'll be better than JavaScript anyways. Oof. Oof.

Collapse
 
jaradc profile image
jaradc

Totally disagree. Javascript syntax is ugly, making it pointlessly more difficult to learn. Python syntax is clean, logical (for the most part), elegant, structured, and is easy to learn for a complete beginner. Whoever says Javascript is a nice language has either learned coding through Javascript as their first language, or has a completely opposite brain from mine.

Thread Thread
 
codingjlu profile image
codingjlu

C++ was my first language. I love JavaScript for its versatility, in my opinion making it an insanely powerful language. There's no use trying to integrate Python everywhere; the syntax is simple, but so are its features. JavaScript was built for the web, and I think that's a spot no other technology should replace. Sure, maybe use WASM for some heavy computation or graphics, but DOM manipulation? Leave that to JS.