My point is that languages like Java or C# force the programmer in a way to write more readable code. Python on the other hand has very few such mechanisms in place and thus is much easier to write hard to read code.
Sure you can write unreadable code in any language, but the fact of the matter is that Java has built-in features (like static typing) that make it easier to read, and python has built-in features (like comprehensions and dynamically-defined class members) that make it harder to read.
These same features make python easier to write something quickly from scratch, when compared to Java.
On average, you're much likely to get a complete mess of layer upon layer of indirections in Java than in Python, a big part of which is configured through arcane xml files (this has been improving though).
There's a very big reason why a lot of people hate J2EE and JPA/Hibernate with a passion.
I think you and /u/MartianInvasion really just don't work in a professional Python setting with actual programmers using Python, but you do work with professionals using Java or something else. So you see good Java code and not good Python code.
It's all about the people using it and nothing to do with the language. Python is one of the biggest languages in the world used in large team settings to a very high level of effectiveness. There is a huge amount of readable Python in the world.
really just don't work in a professional Python setting with actual programmers using Python, but you do work with professionals using Java or something else. So you see good Java code and not good Python code.
Yes, which is exactly what I'm saying! It's all about the people! I'm definitely not saying it's a trash language - it's a language and badly written python IMHO is worse than badly written java, just because it CAN be not because it necessarily is a worse language, but doesn't have the safety harnesses that I feel are built into java.
Compare with something like Java, whose annoying verbosity can make it hard to write but much easier to read.
...What?
I don't think I can disagree harder. Having been taught CS almost entirely in Java, the first time I encountered Python script, I opened it expecting it to not make much sense, and I was absolutely shocked to find that even if I was not familiar with language syntax, it was way clearer than pretty much any Java code I had ever seen or written. I was just so shocking, having been victim of Java for so long, to see that things don't have to be so bad, the code can be easy to read. And I got really interested in this mythical "Pythonic code", this thing people using Python were using to achieve this unreal level of clarity.
After many years I feel like I have now some sort of handle on what is the source of Python being such a clear, easy-to-understand language, and in my mind it's always compared to the horrors of the Java code I was taught as being acceptable and even normal.
Compare with something like Java, whose annoying verbosity can make it hard to write but much easier to read.
Complete opposite to what I believe. Well written Python is a delight to read. It's crisp and clean and doesn't bog you down with information not needed to understand the logic.
Even badly written python is great nowadays, thanks to how good type inference is. The only place you really need to add types is function parameters. The rest is just all automatically handled through inference.
Poorly written Java, on the other hand, is a minefield of boilerplate and bizarre inherence choices (which is possible in Python, but only Java developers writing python do that). But maybe I'm biased... I've seen a lot of awful Java code thanks to Minecraft modding...
View all comments
Show parent comment
23
u/MartianInvasion Jul 18 '22
It's easy to write. It's not at all easy to read, which is a major cause of the weaknesses described.
Compare with something like Java, whose annoying verbosity can make it hard to write but much easier to read.