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.
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
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??
Flask is even easier.
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
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.
indeed
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
IMO the type system in Python is probably the best out of Python, Typescript and sorbet (Ruby). The platform is very mature - you can find a library for almost anything you want.
Its pretty much the defacto language for operations work. There is an operator framework for Kubernetes, you can write ansible modules with it, standard library provides good file and subprocess modules, etc.
If you want to write a bit of Rust here and there, you can do so easily with pyo3. The language is very good at binding to lower level ones.
Since the standard library is much larger, there is less dependency churn compared to NodeJs.
Good point on the dependency churn, this also helps with security (of supply chain), and seems to be a result of the ethos, creating a managed change process (PEPs) that covers libraries as well as language.
Python is super easy to learn and has a ton of applications. For example, I've been writing HTTP requests to APIs in Java and it is way times easier in Python. Python also has great library support for beginners and pip is super easy to learn and install. Python's syntax is also relatively simple and is easy to read and understand with minimal to no knowledge of coding. OOP is also not too important to use in Python - as it's something that often scares away new developers.
Overall, it's a great langauge to start with if you are just learning progrmaming (I started with it myself) and it peaked my interest in learning other languages.
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.Like C, but easier to read and way slower.
A new revolutionary package manager per ~month (pipenv, dephell, flit, pdm, pipx, pyflow, conda, poetry, hatch, curdling, edm, pipsi, ferry, ...)
Python is a modern object oriented programming language, it primarily focuses on web development, ml, ai, automation, it has a not so great package manager, simple syntax, easier to understand and use, I primarily use python for web development using django, but some times flask, it has a large community, so there is someone to help you out with anything
Big strength #1) Python has several good libraries that will let you write functions in Python that actually execute compiled on a GPU. This is a big reason why it's so popular in Machine Learning. Python itself is super inefficient (like most loosely typed interpreted languages) but it let's you run code in a more efficient way for something like a neural net.
2) pandas and numpy
lol markdown made my #2 a header
It's said that VisiCalc was the killer app for Apple II. Numpy is the killer app for Python. Conceptually, the things in Numpy are more or less to be found in APL and MATLAB, but Python is friendly and accessible, so why wouldn't it be your go to for array crunching?
I just love the simple syntax of Python. And the fact that you can just write a few lines in any code editor and run it right away, without installing a ton of stuff.
Python is the JavaScript of non-web stuff.
Our Endtest engine is built with Python, and we wouldn't switch to any other language.
I wouldn't use Python for Web Development, because I'd have a hard time finding resources and questions on StackOverflow about that niche.
But if you're looking to interact with files, image editing, video, OCR, machine learning stuff, there's a huge community using Python for things like that.
Here's my pitch:
Good Python reads like prose, it's self documenting and does what it says on the tin. It has a friendly community and a great set of documentation and excellent libraries that make common tasks a breeze. It's easy to jump in a repl to quickly trst some things, transfer to a unit test and then production code within an hour or 30 minutes or less.
I use python every day, a lot. I can't tell you if it's better than any other scripting language, but it is good and easy to use.
Package management is better than npm, but that's the only comparison I can make
If you like class based object orient programming, it has that, and its syntax is nice and concise.
You can also use it procedurally, no need for a wrapper class.
It's duck typing means unit testing is easy.
Monkey patching is probably to be avoided, due to how unpredictable it can make things.
It's implemented on multiple architectures, as well as in multiple frameworks (Jython and IronPython spring to mind), so you can run it on most systems as well as embed it in applications as a way to script the app.
There are so many libraries built in as well as third party, so if you need to do something in python there's almost certainly someone who has an example you can crib from.
I would say its main downsides are it can seem a little slow (although I don't usually notice), and it's Global Interpreter Lock means you can never leverage the advantages of a multithreaded environment.
To craft a meaningful personalized offer to you in this way, assuming you agree everything is relative, you'll have to reveal more about the reason you are interested in Python. Have you used some other programming language before? What do you plan to achieve with Python? Python can be the greatest language you've ever written code in, its syntax might appeal to you, you may be tempted to use it for absolutely every coding project landing at your desk and then...
Screwdrivers are made for dealing with screws, gardening tools are for the garden, wrench is for plumbing. I am not saying you can't use a screwdriver for plumbing but every tool has a set of problems it can address.
Why I love Python? I started learning Java first. It was a time when you'd have to dig through Java's APIs to find a data collection object to go beyond the built-in array. And Java's API was already an overgrown jungle. Python on the other hand already has data collection objects built-in and ready to use. Dictionaries, tuples, lists.
Python's math, statistics and machine learning libraries- another reason to love Python, along with the Anaconda project that brings all of them together in a convenient and easy to use interface that is just inviting itself for quick prototype testing and for a student of Python that is a lot of help.
Python's API- easy to search through for modules you might need in a convenient web interface, along with explanations of what each module does and examples of its usage. In all honesty, I don't know if Java progressed in terms of the search usability of its APIs since Oracle overtook it, I saw what Java in the past looked like, how Python nowadays look like, and am not turning back just based on improved search through API.
You may come back and argue that language X beats Python in a segment that I mention above, fine, I just laid out the case for Python. I am interested in machine learning and Python just has everything I need now and as I progress with my self-study I'll probably be covered well by what Python provides.
PEP20, i.e. a really early entry to the Python proposals, is the Zen of Python
That can apply to any language, but in Python it can be used as a way to critique code someone's trying to get merged, and people shouldn't complain about you being picky.
Python is a mature language
Has a low learning curve
Comes with batteries included
Has an impressive standard library
Easy to setup across multiple environments (and available by default on most systems)
Pros :
Very high level language. Syntax very close to the english language.
Zero boilerplate
Easy to learn and get started.
One of the best send most loyal communities around.
Tons and tons of library support
Cons:
Not the fastest.
arent you tired of all semicolones, curley brackets, type declaration and hard syntax
try python it has iterators, sequences and the elements can be of whatever type
[ 1 , "i am an str" , False , Person("name",age=13)] can you believe this works
Easy to learn, hard to master. You can do all sorts of things with.
Very good for heavy math of data processing, Numpy and Pandas are able to keep your code as readable and as efficient as possible.
AND You can run python in browser
wasmeditor.com
Hmm,Pyhton is a... Human readable dynamic garbage collected interpreted not very fast versatile simplified syntax intended(no semicolons) abstract OOP language
It's slow so you can take your time and never feel rushed on the job!
Only joking of course, it's not that slow 😉
You are not allowed to do python.
--Parents
Easy :mic_drop:
I don't see the point, unless you do data science or stuff like that ... for web development I think it's decidedly non-mainstream, and increasingly so.
Following
I run venv in Anaconda, but if you prefer more in-project venv like Composer or NPM, try Poetry.
You forgot a word in that sentence.
It does everything brilliantly.
Only slower :)
One-second pitch: No. Thirty-second pitch: Noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo[redacted].
The logo. Everyone knows if the logo is cool, you should use it.
🙃
You write it and it runs it! :D
easy to prototype - hard to scale to complex projects