Let's say I've never used Python before. Can all the Pythonistas out there give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (69)
Python has a worse package manager than Ruby's (as in there are multiple and none of them are stellar), other than that is great and does everything Ruby does more or less, with some bigger communities (especially on ML, data science) and probably equally sized communities on web dev (though fragmented around two or three major frameworks: Django, Flask and FastAPI probably).
Python is less DSL oriented and you can mostly ignore multiple inheritance. Even its most popular testing framework, pytest, works great with declarative dependency injection: a test function can declare which objects it needs and the framework will provide it to it.
Python modules are easier to grasp than Ruby modules as well (also because they're not exactly the same thing :D).
Also, Python async game is a bit further on than Ruby's, especially around the paradigm of structured concurrency, very useful to rein in the complicated logic of async programming but requires a bit of paradigm shift so it's probably underused still.
As you know, I enjoy both :D
Django seems easier to learn than Rails.
that I don't know! They are very similar, one is MVC, the other one is MTV (Rails's controller actions are called views in Django and Rails views are templates in Django). They both have an ORM which requires some learning time. They both have lots of batteries included
I just started my Django journey any tips??
I learnt Ruby on Rails first, then few years later I learnt Django. I didnt like Django at all.
I'm not throwing shade at django, its just everyone has their preference
Flask is even easier.
i once heard some companies like quora are using python as their backend language. what could be the reason of this choice since python has a reputation of being slow? the question goes for all medium to large companies using python backend frameworks.
In my experience the language is not often the primary cause for "slowness". After all the majority of web apps are I/O bound. It is true that in benchmarks is not the fastest but speed of language isn't usually the only reason you choose to "lock in" into a community (which you do after all if you decide to invest for many years building a company with a stack).
That said, Quora is 12 years old. Go, which is often used as a comparison for fast productive languages with a garbage collector, is 12 years old ;-)
ok, on that point of Go, is not it by that time Java was there and i hear many people arguing for it as fast, stable and suitable for writing large complex systems
Dunno, Java being the defaultt choice was one of the reasons why I started using Python in the first place :) Again, I don't think you can measure developer productivity just by "fast". Otherwise we'd only write in C or Java but we don't ;-)
thanks you
Let's say django is working on a compiled Versione of ur code that way we can find beats something like laravel so easy
And get some good response times ok not as fast as node or go or even .net but when the response time is good there is not big difference between 80 and 120 ms after all they both are great
So we they aren't thinking in that point in matter of speed
Python is maybe one of the most versatile language out there. Now you can even do web frontends with it:
A Todo App With PyScript
Bas codes γ» May 10 '22 γ» 5 min read
JavaScript is maybe one of the most versatile languages out there. Now you can even do machine learning with it:
tensorflow.org/js
ππ
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.
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.
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.
Why not just use JS...?
Because JS is a badly designed language with many pitfalls?
TS is alright, but Python is still way better.
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).
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.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?
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.
Okay, good for you.
Saw this on Twitter today:
Also webassembly work underway and Python in the browser: github.com/pyscript/pyscript
It's very human-readable and was designed to handle data and mathematics well, if not at the speediest.
nice pitch!
Thanks! I also forgot to mention that the community is supportive, and that's a big reason to learn a new language for me.
imgs.xkcd.com/comics/python.png
classic!
it's easy to learn and you can do pretty much everything with it. "it's a slow language", but the speed at which you can make stuff is worth it.
it's simple, user-friendly, easy to read, at this point, question should be "why NOT to learn python, anyway?"
Mature but very active ecosystem (see excellent teapot image hereabouts!) with sane versioned package repos and good package managment, gentle learning curve, excellent control plane language, effective (if not super efficient) data plane language although high-level expressivity through libraries like
numpy
and bindings to other tech liketensorflow
can remove most of the performance challenges (look at how fast some of the python solutions are to advent of code 2021 for examples).Plays well with 'as-a-service' things (vendor-supplied bindings to all popular cloud APIs), readily containerisable, the language of choice for tooling in multiple Linux distros (including Debian and derivatives) and likely to remain so (and thus remain relevant) for many years.
Fewer weird typing issues than Javascript (no need for a Tython equivalent to Typescript :), idiomatic ethos (peps.python.org/pep-0020/) with well maintained tutorials.
Neat Azure storage backup tools available (natch): github.com/phlash/azure-sync
You can choose to become a white hat hacker or black hat hacker. Giving you serious street cred and you get to wear hoodies like Elliot Alderson in the series Mr Robot.
FYI white hat hackers are good guys and black hat hackers are bad guys.
Live your dream π
Feel free to check out the holy scriptures of the pythonic bible I have been writing.
Edit: Don't forget to slap that star button an odd number of times.
Join The Legion.
Python's use of indent level as syntax is widely copied, as evidenced by Coffesscript, HAML, and SLIM. The absence of block delimiters such as
{}
orbegin end
makes Python particularly VIM-friendly. I find it one of the fastest languages to edit.