Crosmando: Isn't it generally accepted that Python is a shitty programming language that only became well-known because Google was shilling it relentlessly for a decade or so?
Python is actually a really nice language for writing code in.
Some users find Python's dynamic typing to be annoying for larger code bases, but at least type mismatches tend to result in an error.
Explanation:
* The following code works thanks to dynamic typing
x = 3
x = "three"
(In other words, a variable can change type. Note, also, that variables don't need to be declared ahead of time, which cau cause issues if there's a typo.)
* You can't, however do the following:
x = 1 + "1"
(Perl silently converts "1" to a number and sets x to 2. JavaScript silently converts 1 to a string, and sets x to "11". Python will give an error to the effect of "can't add a number and a strong".)
(It's better to get an error message right away than have the program silently run and have a bug you need to track down later.)
Crosmando: Isn't it generally accepted that Python is a shitty programming language that only became well-known because Google was shilling it relentlessly for a decade or so?
Orkhepaj: oh is it a programming lang? why would anybody name it a snake then? makes no sense
hmm
checking it out looks like it is used by apple fans
Actually, I believe Python grew up on Linux or some UNIX variant. In fact, Python is in the standard install of many Linux distributions, and is even essential in some. For example. Gentoo's emerge program, which you use to install software, is written in Python (which means that removing Python, which emerge will refuse to do, would prevent you from easily re-installing it).
Also, I believe the language is actually named after Monty Python.
lupineshadow: Stop chatting shit mate. Python is awesome.
It has a bad rep because of some old tropes though
"That Django's got your baby"
Magnitus: Python is the most productive programming language that I know. If you're gonna do everything with one language and nothing you'll do will be too cpu intensive, Python is probably your Huckleberry.
That being said, compared to most other programming language, it runs pretty slowly, it has a dependency on the Python interpreter, plus any package you require, to run and last I checked, the packaging and bundling ecosystem for Python was rather fragmented.
If you're ok with knowing more than 1 language, for some specific problem domains (ex: Golang for devops on cloud solutions or for command line clients, Scala for big data, NodeJS or Golang for high performance io intensive web servers, C or Rust for performance critical system-level components, etc), better alternatives can often be found.
Also, imho, Flask > Django. It is less opinionated and more minimalistic.
There's a trade-off between programmer time and CPU time. In many cases, programmer time is more important, and Python takes less of it than some other languages. Hence, if you want to get the project completed faster, or if you just want to make a prototype before you re-write in a higher performance language, Python is the ideal choice (or at least close to ideal).
Orkhepaj: so it is not as slow as those java apps?
which is better java or python?
Magnitus: I'm not a Java fan so I'd be biased in that answer.
Over the years, I've specialized in C++, Python, NodeJs and more recently Golang. I've done some Java on and off but it never stuck (and after tackling some codebases implemented with Spring in later years, I can say I want to have as little to do with the modern Java ecosystem as humanly possible).
Java is often accompanied by burdensome frameworks (ex: Spring, JBoss, etc) that add a significant complexity overhead to anything you do (and are old-school in their opinions, they often assume for example that your Java app will be a persistent standalone application and won't be managed by an orchestrator like kubernetes or even systemd) and is dependent on the ram-hungry, slow to boot JVM (which also needs to be installed on whatever machine Java runs), which in the age of containers, leaner virtual machines and cross-platform compilation that produces self-contained binaries for a lot of platforms anyways, is a step backwards in my opinion.
That being said, in terms of cpu utilisation, yes, Java > Python, but for those use-cases, I much prefer to use Golang.
Java is also opinionated about your choice of programming paradigm.
In particular, Java essentially forces object oriented programming. You can't even write a basic Hello World program without declaring a class and a member function, with something like 8 keywords that someone unfamiliar with OOP is not going to understand. By contrast, in C, all you need to do is write a single function, with void parameters and a simple return type, and it will run.
(C is a decent language, at least until you're dealing with strings or dynamic memory.)