I use both languages. Let's compare the two languages:
a = "Hello "
b = "World"
c = 123
print(a + b) # Works and prints Hello World
print(a+c) # Does not work as a is str and c is int
Python's built-ins are very expressive (list, set, dict, tuples) and most are sufficient or most simple programs. This allows you to quickly prototype your projects.
Both Java and Python have extensive ecosystems. You will generally find libraries doing what you need in either of these languages.
The JVM ecosystem also has other languages which avoid the short-comings of Java e.g Scala, Kotlin, Clojure. These languages are much less verbose and can also leverage the extensive Java libraries.
At the end of the day, choosing Java or Python boils down to your preferences.
Here are a few niches where one can be better than the other (just my opinion):
Additional info: there's a version of Python (stuck at Python 2 unfortunately) which runs on the JVM: jython.org/
Yes, it is unfortunate that JPython never took off as much as JRuby did.
Minor typo: that's Clojure, not Closure.
Thank you, Raunak!
I know that the question was Java vs. Python.
I don't know many people who still develop frontend with Java and Python.
Another point regarding Expressiveness, there are many languages that are built on top of the JVM and with a goal to reduce verboseness from the code.
What do you see from your end?
which JVM language do you use? ( if any :) )
In web development, I feel that familiarity with a framework (its strong points and pitfalls) often tops any language feature. I use Flask in Python for quick prototyping and Dropwizard in Java for production ready applications. I have heard good things about Express in Node.
Re JVM languages I am getting familiar with Kotlin. It has many good features like data classes, Sum types, pattern matching and coroutines.
In nearly any development, familiarity is king! If someone understands general principles of good software design, they can make good software in any language or framework they know well, whether that be Java, Python, C++, Haskell, or COBOL.
One clarification: usually Java performs very close to C (no 3x slowdown). In some cases (heavy allocation/deallocation) it may outperform C due to much lower overhead for such operations in Java runtime.
New java versions can create custom small jre images within applications so the need for a user to have a jre installed is no longer needed. Also jpackager can create installers. Overall java experience to deliver a full application as a whole has gotten a lot better.
And one comment: yes, Java is verbose. But Java verbosity is not a bug, but feature. It allows Java code to explicitly provide context. This context significantly reduces mental overhead and navigation back and forth between usage and definition.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.