4 ms·
> Gross. Python is a million times better than ruby to read and write why do you think that?
by anko 3y ago
> Gross. Python is a million times better than ruby to read and write
why do you think that?
- Demiurge 3y agoI wouldn’t be so harsh, as to call it gross, but I also much prefer Python, because Ruby reminds me of Perl. It feels clever, but not in a way that I expect to shorten its BNF. It still bugs me a bit, that ruby has pascals ‘end’, and Python uses whitespace, but it worked out in the real world. Given just the syntax, I would always recommend Python as a first language to scientists in a lab, rather than ruby. The code just reads and writes itself better, without special characters. But, I think it’s not fair to call Ruby gross, given some people love C++, php, bash, JavaScript… I’d take ruby over many languages, given a choice.
- drdaeman 3y agoSyntax is such a minor detail, I don't know why people care about it so much (unless it's APL or something similarly exotic). The much bigger elephant in the room is the semantics. My personal pet peeve is that Ruby, just like Perl or C, doesn't have any sort of file-based isolation. While importing something in Python normally doesn't mess up any namespace except for the stuff you've just imported, Ruby basically leaves this to programmers' and they create monstrosities where one require statement can do way too much magic to my liking. And while there are some libraries and frameworks that are closer to Python in spirit ("explicit is better than implicit"), Rails is something that really throws me off as most things just magically happen to work with some incantation that seemingly comes out of thin air. This new autocomplete thing may be a real breakthrough for people who learn by getting their hands dirty and trying to write something, probing around the available methods and functions to find the appropriate one. If it can suggest what's possible/available, a lot of the magic may fade away and become proper, explainable hard science. Just a personal opinion, of course.
- ArtemZ 3y agoFrom my perspective (DevOps/SRE) Ruby is a horrible platform. It is heavy on resources, it is difficult to run (Unicorn is a pain), maintain, monitor, debug. Many Ruby projects has silently failed (Chef? Puppet?) and the biggest Ruby tool in DevOps world which is Gitlab is incredibly difficult to run on premise and struggles with a ton of issues that I believe are caused by the platform. If I had a choice, I would never work on a ruby project.
- vidarh 3y agoFrom my perspective of devops, I've built large hybrid cloud deployments in Ruby (from scratch, including an orchestrator written in Ruby) and would again given the right requirements, as for tooling the ease of writing Ruby outweigh anything else, and for running it it is no different or more complicated than any other container workload. It's a bizarre objection.
- oblio 3y ago> as for tooling the ease of writing Ruby outweigh anything else Your team mates probably object to that ease of writing, as they did for Perl 20 years ago.
- vidarh 3y agoWhether you write unreadable code or not is not a function of language. This is a lazy attempt at criticism. My preference for Ruby is in part because reading and understanding well written Ruby is a joy compared to every other of the dozens of languages I've used.
- cloudoogie 3y agoAnd since (un)readable code is not a function of language, you cannot state in your next sentence that reading well written Ruby is joy in comparison with other languages.
- vidarh 3y agoOf course I can. There is no contradiction there. You can write readable code in any language, even assembly, but that does not mean well written code in a language that is also particularly readable won't be more of a joy to read than well written code in a verbose or hard to read language.
- oblio 3y agoThe first statement is provably false, empirically, as huge systems are overwhelmingly not written in dynamically typed languages. Not all languages are created equal and some were designed to be more conducive to maintable code for large teams of developers. Ruby is not one of these languages.
- djur 3y agoWhat "special characters" are you talking about in Ruby? My impression is that Ruby and Python are roughly equivalent in terms of non-alphanumeric characters used in syntax.
- ajanuary 3y agoSome symbols I can think of that Ruby uses that python doesn’t: $ for global vars @ for instance vars :: for namespace stuff => for map key, value separator {||} for blocks .. and … for ranges %w for special array construction : for symbols ? and - in method names ?: for ternary expressions #{} for string interpolation And python that Ruby doesn’t have: :: for slices @ for decorators And for the symbols that they both share, subjectively, a lot of them are used for often in Ruby.
- ric2b 3y agoRuby does have the block related stuff like the & argument and the single line block { }. But other than that I also think it's relatively similar to Python (which doesn't even support blocks anyway).