Python vs Java – Which Programming Language is More Productive?

Python and Java are two powerful and popular programming languages. As a beginner it can be difficult for you to decide which programming language you should learn first. As I am a Java programmer so I would suggest to learn Java first. But this doesn’t mean that Java is better than Python. Both the languages have many advantages over each other. Like Java is faster than python while we have to write less code in Python than Java. Below I have shared an infographic about Python vs Java that shows difference between Python and Java.

Python vs Java - Which Programming Language is More Productive?

Also Read: Difference between C and C++

Python vs Java

Infographic Via Perception System

4 thoughts on “Python vs Java – Which Programming Language is More Productive?”

    1. Yuriy Nakonechnyy

      CPython may be faster than Java but only for single-core operations, because CPython was built mainly for single-core machines. If multiple cores should be utilized (which is very important in web server applications handling multiple requests simultaneously), then CPython gets really slower than Java by creating new sub-processes comparing to threads in Java. This problem is caused by GIL – Global Interpreter Lock.

      Ironically, Jython – Python implementation running on top of Java VM – doesn’t have this problem 🙂

      1. You can turn off the GIL in Cython and use multiple cores via. threading.

        Just use “nogil: ”

        Only downside is you cannot access python types while doing this (they must all be static cython types).

        In practice it works well, just stick to the types.

        Issue could be if you use a dictionary as there is no static cython type for that yet. But could get around this by using a c++ library for a dictionary* and binding to that, which cython does with ease.

        *e.g. with functions to read / write / remove. plus an extra function to convert the python dict into your c++ dict (which might do at start under nogil)

        Note (and this is important). Only need to do this where really need speed. Don’t forget cython with static types compiled in machine code is many times faster than java code. So even running in single core it will still usually run faster than java making use of some 8 core machine! AND no need to bother splitting your task up into threads. AND it will run fast on your slower machines, which is where the bottleneck usually is, e.g. the dual core machines you still need your app to work on.

  1. I think you missed some points:
    Start Java7, file read you can use try with resource, it will be much simple than early version of Java,
    For Python, you didn't say Python 2.x migrate to Python 3.x issue.

Leave a Comment

Your email address will not be published. Required fields are marked *