Python vs java advantages

does one language have any advantage over the other ie performance or libraries?

1 Like

I’m not so familiar with python mode but basically it uses Jython to run it on JVM so there shouldn’t be difference in performance / libraries
https://py.processing.org/tutorials/python-jython-java/

3 Likes

Concerning performance, Java is generally faster.

Quoted from:
image
Comparing Python to Other Languages
:

Python programs are generally expected to run slower than Java programs, but they also take much less time to develop.

Python is generally regarded as easier to learn, and in my opinion, is more elegant concerning its design. With regard to libraries, there are many for each language, so each might have the best library for some particular purpose.

5 Likes

This is a myth. Not all languages run at the same speed on the JVM just because they end up as bytecode. Aside from the fact that the JVM is optimised for Java, some language features (eg. dynamic typing) make implementations slower. At least that is true of things pre-Graal, which may change some of this.

2 Likes

As someone who prefers Processing Python mode, even if it is slower than Java, I’d like to point out some advantages and issues:

Against:

  • Fewer examples & tutorials available
  • Processing Python mode, at this point (see last link of this post), is based on Jython 2 so:
    • not all Processing libraries will work (most will work fine)
    • few modern Python (3) libraries will work (no library with C extensions like numpy, pandas, etc.)
  • Slower, as mentioned

For:

  • In my experience as a teacher, it reduces the cognitive load not to have to take care of types, variable and parameter type declarations, already in the first classes.
  • I enjoy working in a dynamically typed language, it feels more concise and expressive to me.
  • I enjoy using data structures like lists, sets, dicts and tuples, and even deque, without hassle and with minimal bureaucracy.
  • I believe that my students might benefit from learning Python as they might want to automate stuff in Blender, FreeCAD and many other design related software as I point on this article:
    VILLARES, A. B. A., & MOREIRA, D. (2017). Python on the Landscape of Programming Tools for Design and Architectural Education . Presented at the SIGRADI 2017, ConcepcĂ­on, Chile.

(more at Resources-for-teaching-programming)

6 Likes

@villares some good points, but does also emphasise how much this question is really about Processing’s dated and restricted take on Java, rather than Java itself. Most of those for points are weaker if comparing with Java 16.

2 Likes