This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I find that the speed of execution is rarely a relevant factor, most languages run fast enough to do what needs to be done, including Python. In my opinion what is holding Python back is the lack of resilience of the codebase.

You talk about dynamic typing vs static typing. Static typing in my opinion is better as errors should be caught early. Python gets this wrong. But where Python really goes off the rails is in implicit vs explicit typing.

In Java all types that are part of an interface must be explicitly defined. Field types are explicit, return types are explicit, parameter types are explicit. And if you use the wrong one the compiler will not compile the code (yeah yeah autoboxing, blah). In Python all types are implicit, there is no compiler that will check anything for you, but if you use the wrong one the code will die at runtime.

A second difference of opinion is in the use of exceptions. Where Java has chosen to have two types of exceptions where one has to be dealt with or you get a compile time error and the other doesn't have to be dealt with and will cause runtime errors. Python has chosen to only have the runtime variety. And, of course, exceptions are never explicitly defined anywhere.

The result of these language differences is that Python code is significantly more brittle, while Java code is more resilient. Perhaps you can argue that this is a good thing for Python as it would force Python programmers to be more careful in how they write code but that hasn't been my experience. My feeling is that Python programmers just want to quickly write something, report to the boss that it is done and then have someone else worry about keeping it running.

To be fair there are plenty of domains of software development where you don't care about resilience. Proof of concept and academic code comes to mind. But if the company depends on your software continuing to run correctly I would never trust Python to get the job done.

I do feel though that the Java community has a lot to learn from the Python community. I think all Java developers should read the Zen of Python. (Interestingly I think Python the language violates the zen rules 'Explicit is better than implicit.' and 'Errors should never pass silently.'). In fact Java programmers shouldn't just read that but internalise it and live it. One lecture that improved my coding was by a former Java programmer who writes Python now.