DEV Community

Discussion on: Why all this hate about Python?

Collapse
 
shacham6 profile image
Shacham6

Python's simple syntax make it the best scripting language.

SCRIPTING.

Automation, and small things that should just make life more pleasant. Any attempt of using it to something bigger than that, was met with NO redeeming qualities once or ever.

Problems with dependencies; the lack of type hinting (since the bastards broke backwards compatibllity BEFORE they added type-hinting, the single most important feature in Python 3) makes Python an unreliable, bug-prone, confusing piece of mess (again, solved in Python 3 the issue with the type-hinting, but since we have legacy Python 2, people refuse to upgrade).

After EVERY Python project we have ever done, our primary lesson is: do in Java next time.

Python 3 on the other hand, has the potential of actually being scaleable.
I mean, the mess that is pip is still there, but type hinting is, again, the single most important feature of Python if you ask me.

My negative view of the language comes from terrible experience of people using it as the an actual language, for actual projects. It doesn't feel like it was ever intented to - but people know Python and are lazy to learn any statically typed language, which annoyes me to no end.

But if used correctly - Python (Python 3 to be more specific) is an important and useful tool at you disposal.

Collapse
 
scottanderson42 profile image
scottanderson42

Bad programs can be written in any language; Python's flexibility means you need to be more disciplined than in a statically typed language like Java. I've worked on Java teams before that would be nightmares if they were using Python.

That said, if your team's testing, craft, and review discipline are solid, Python is just fine for projects large and small. Similarly, overall design and architecture outweigh a language's straight-line efficiency for most classes of projects.

I've been using Python as an actual language on actual projects for years without any nightmares.

"the mess that is pip" - I'd be interested in more details there. Java is no stranger to dependency hell either, particularly in the world of EE.

I do agree that the migration to Python 3 was completely mishandled. I think things are finally getting there (Django 2 refusing to run on 2.x is a huge step) but wow, what a way to drag things out.

Collapse
 
shacham6 profile image
Shacham6

You are correct. A lot of bad software is written in any language.

And yes - with great discipline, great software can be written with Python.
But why even try when there's no real benefit? The language is still very slow when compared to any compiled statically typed language.

I called pip a mess but I admit it was uncalled for. Pip is fine.
What I generally dislike is the way Python handles libraries in general - with them being global and all. It creates mess, with one project requiring 1 version of a library and another project another - what do you do?
The libraries are global, and it affects ALL of your projects at once.
Another problem is that should I create a Python project and want to release it on production, I need to NOT ONLY install Python, but pip with every dependency as well, at a global scope.
With Java - I can compile the my project to include the libraries I use. I need only the JRE on production, and I'm golden :D

For the very least - I despise Python on a project level. A lot of things can go horribly wrong, and a great level of discipline is required to make the most out of it.
I work at place where people use Python only because they needed to get things done QUICK.
They didn't have discipline.
And I'm the one that suffers all of their horrible, horrible choices.
So yeah, more often than not I'm more scarred fron the misuse of Python than anything else.

Thread Thread
 
evanoman profile image
Evan Oman

Java + Gradle (or any of the major build tools) = 😍😍😍😍😍

Thread Thread
 
scottanderson42 profile image
scottanderson42 • Edited

"But why even try when there's no real benefit? The language is still very slow when compared to any compiled statically typed language."

Because straight-line execution performance is, for most applications, far less important than architecture and team productivity. For a web site, caching, CDNs, and concurrent processing will take you much further than your language choice will (within reason: don't write your web site using DOS batch, please). Python is Fast Enough. And when it isn't, it's very good at calling your favorite compiled code for performance sensitive pieces.

Additionally, it can be far more productive than a language like straight Java.

"What I generally dislike is the way Python handles libraries in general - with them being global and all. It creates mess, with one project requiring 1 version of a library and another project another - what do you do?
The libraries are global, and it affects ALL of your projects at once."

You use virtualenv, as it is the tool that was created specifically to address project-specific libraries. Global libraries are a solved problem.

"Another problem is that should I create a Python project and want to release it on production, I need to NOT ONLY install Python, but pip with every dependency as well, at a global scope.
With Java - I can compile the my project to include the libraries I use. I need only the JRE on production, and I'm golden :D"

As above, no, you do not need to install these at global scope. In fact, you can run different versions of Python with different projects in the same scope as well. J2EE can have more of a problem with global system libraries (remember log4j vs. commons logging in Tomcat?) than does Python.

"For the very least - I despise Python on a project level. A lot of things can go horribly wrong, and a great level of discipline is required to make the most out of it."

Great discipline is required with every language to make the most out of it. Python is no different here.

"I work at place where people use Python only because they needed to get things done QUICK."

Yes, that is a very real benefit of Python.

"They didn't have discipline.
And I'm the one that suffers all of their horrible, horrible choices.
So yeah, more often than not I'm more scarred fron the misuse of Python than anything else."

This again is not a Python problem, it's a management and team problem.

Thread Thread
 
krudflinger profile image
Clay Kuppinger

Pyenv + pipx + pipenv for all projects.

Collapse
 
aghost7 profile image
Jonathan Boudreau

From my perspective, I'd rather code in a language such as Python instead of a language with an unsound type system. I've got some side projects in Rust and Scala but I don't know if I will ever find a job in these languages.

Collapse
 
shacham6 profile image
Shacham6

Examples for languages with an unsound type system?

Thread Thread
 
aghost7 profile image
Jonathan Boudreau

Java and Typescript.

Thread Thread
 
shacham6 profile image
Shacham6

What's unsound about them?

My only complaint about Java is the nullable reference types, really, and I have no complaints at all with typescript (but to be fair I didn't use it all that much). Why do you dislike them?

Thread Thread
 
evanoman profile image
Evan Oman

Wow, the more I read this site the more I want to take on the Java evangelist role. Haven't come across a single advocate, only hate.

Thread Thread
 
shacham6 profile image
Shacham6

I like Java! I really do. I certainly like it more (god, so much more) than Python

Thread Thread
 
aghost7 profile image
Jonathan Boudreau

I'm not "hating" on the language, I've just stated my preference of python over it because of its type system.

Thread Thread
 
aghost7 profile image
Jonathan Boudreau

I remember when I was learning Java that I had to use upcasting (some of the nio apis, etc). Whats the point of a type system if you're upcasting?

Thread Thread
 
evanoman profile image
Evan Oman • Edited

@aghost7 you are absolutely right, I have just noticed a general lack of enthusiasm and happened to mention in reply to your comment, which was not hateful. I apologize.

For upcasting do you mean implicit upcasting? We typically do that in order to "program to an interface" which helps facilitate a clear separation between the implementation of a module and how it interacts with other modules (ie loose coupling).

Thread Thread
 
aghost7 profile image
Jonathan Boudreau • Edited

Sorry, I think I meant downcasting. I've had to use this on several occasions when I was writing Java. I think the worst I've encountered in the standard library is casting object to something else.

Thread Thread
 
evanoman profile image
Evan Oman

Hmm, yeah usually you want to avoid downcasting at all costs (most Java devs consider it a code smell). Java is certainly far from perfect but Java 8 and 9 make it muuuuch nicer to work with (especially if you like Scala).

Thread Thread
 
aghost7 profile image
Jonathan Boudreau

If you're referring to streams I'm afraid that there's still some catching up to do (based on the last time I looked at it) when compared to Rust or Scala.

Thread Thread
 
evanoman profile image
Evan Oman

Streams, Optionals, Futures, Method References, and Lambdas everywhere are all great additions but it definitely lags behind Scala in some ways (never tried Rust).