5 ms·
Ah I see the problem, the example would need to be larger for the classes to be more than data holder classes. Do you think when the classes are larger with so
by Uchikoma 14y ago
Ah I see the problem, the example would need to be larger for the classes to be more than data holder classes.
Do you think when the classes are larger with some logic, the ratio of Java/Python LOC would change?
- masklinn 14y agoIt probably depends on the work being done — matrix computations likely wouldn't be significantly shorter in Python, even with numpy — but considering the java styles I know of (rather defensive and comparatively low-level) and the Python styles I also know of, as long as your python isn't java I'd say it should remain significantly shorter. Not as short as replacing 20 LOC by a single namedtuple, that's a bit extreme, but 2x is what I expect of (mostly) translating java code into python, that's the rough overhead of the language itself when saying the same thing the same way.
- Uchikoma 14y ago"[..] as long as your python isn't java I'd say it should remain significantly shorter." My intent with the post was to create empiric knowledge, I'm not a follower of the idea anecdotal 'evidence' trumps all that is pervasive in our industry. So thanks for your opinion, but I'm not interested in the least in anecdotes when comparing languages.
- Niten 14y agoIn truth, I wouldn't use anything other than a plain Python string to represent an artist's name, if that's the only thing about the artist you're interested in. But it's hard to have a meaningful conversation about such a contrived example as in that link. To answer your question, though, yes: all other arguments about Python vs. Java aside, the LOC ratio would change dramatically in Python's favor once you start to add actual program logic. (Unless you're stuck with an architecture astronaut for a Python programmer.)