Hacker News new | ask | show | jobs
by btilly 5058 days ago
I am curious about what, specifically, you find easier to do in Java syntax than Python syntax.

Seriously, there is a fairly direct translation from any Java you might want to write to completely equivalent Python. Sure, Python offers more complex techniques such as list comprehensions and iterators. But you don't need to use them. You can just write Java-like Python.

2 comments

And, the OP says he wants to move away from Python to a C-like language for better arrays? It's a weird reason given that arrays are not that complex a data structure, plus the option of using numpy arrays, which are quite fast and capable.
Interfaces.
Abstract base classes. See http://www.doughellmann.com/PyMOTW/abc/
Absent static type checking and manifest typing, abstract base classes do much less than Java interfaces.
Ah yes, the age-old static typing vs duck typing argument.

Sure, in theory static typing can catch bugs. But doing it like Java does it is a lot of work per real bug actually caught.

Whether or not that's true, it is a concrete difference between Python and Java. Python is not a superset of Java.
I never claimed that the two were the same language. My claim was that you can take anything written in Java and pretty much directly translate it to Python.

The fact that there are things Java will flag as errors that a Python translation does not, does not change this fact.

That is a noun. What is the actual use case?
In context, the noun obviously refers to the Java interface syntax.
There's just no need for Interfaces when you have duck-typing at your disposal.
See my remark below.