Hacker News new | ask | show | jobs
by tahdig 2420 days ago
Python and Ruby although in the same category have still different mindset. It is understandable the way you think fits Ruby more.

I tried to learn ruby and was put off by all the magic, last value calculated is magically returned, the useful but cryptic method calls.

It is shorter and more implicit, I like the explicit approach more.

to give you my perspective on the points you made:

- self: more explicit, I would prefer to write it, because there is classmethod(with cls) and staticmethod(without any) params.

- spaces vs. braces: I don't hate braces, but spaces makes it more readable, less things I see(whitespace vs. {}) the less distracted my eyes are from the the characters that do the actual work, you get used to it, I like it more to be honest.

- len(string) vs. string.length: again, no preference, I am used to both.

- py 2 vs py 3: it is not never ending, I helped move a 170K Django project from Django 1.6 to Django 2.1 and python 2.7.4 to 3.6 in a span of a year, we were mainly 3 people working on it on the side, our work was not even in the sprints, 2 senior engineers + 1 really good QA & deployment engineer, it took 1 year because the platform was business critical and we incrementally fixed stuff. At this moment whoever still runs py2 either has been lazy, does not care about technical debt or their business does not value solving technical debt, so they can not allocate time to do it. This is my opinion, might be wrong, maybe there are other reasons also. But the change had to be done for the health and longterm viability of the language.

2 comments

>spaces vs. braces: I don't hate braces, but spaces makes it more readable

Really?? This is my least favorite thing about Python. D: It can't possibly be more readable when you're talking about large code blocks. It just happens that we're never supposed to be talking about large code blocks in Python. "If you want to write a lot of code, you use another language," they say -- probably one with braces, which syntax highlighters can match-highlight on. In Python, you just hope the indentation is far enough to make it obvious where something ends and another thing begins.

If large indentations bother you, good. Braces or not, large indentations and large code blocks should make you start wondering how to refactor them.

And if Python's design seems to discourage over-indentation and oversized code blocks, brilliant.

Nope. The indentation bothered me for an hour one afternoon in the spring of 2001, then it dawned on me what a master stroke it was. Code with ~25% less redundant bullshit.

Less is definitely more here.

This is really interesting to me because Ruby and Python are really close to each other, yet have completely different paradigms.

The syntax, dynamic nature (lack of privates, etc) are so similar yet one is a lot more flexible (Ruby) and another is a lot more explicit (Python).

Ruby is incredibly expressive, the language puts the full power into the authors hands and let them go wild.

There always good arguments on both side of the camp, both have mature web frameworks backed by massive communities. I don't think one is inherently better than the other, it's more a matter of style/mindsets.

I personally love coding in both, in fact today I wrote some ruby code that would run some python code and do stuff with it!

Developer fashion is moving towards more restrictive, explicit, static languages that reduce bugs. The traditional drawbacks and ceremony of that approach are being mitigated through inference and better tooling.

This is likely one reason Ruby is falling out of favor while Python is hanging on and still gaining.