6 ms·
Gross. Python is a million times better than ruby to read and write
by Falmarri 3y ago
Gross. Python is a million times better than ruby to read and write
- qup 3y agoI believe that'll be a minority opinion. I'm a fan of both languages.
- nurettin 3y agoThe opinion is blown out of proportion, but there is a hint of truth. Large python projects are indeed easier to follow simply because of type annotations and signatures. Of course a lot of projects don't follow type conventions and try to invent their own optional parameter syntax using dictionaries and keyword expansion syntax, so the problem still exists everywhere.
- mwgalloway 3y agoRuby has RBS and sorbet to support using type annotations. They are each relatively new and aren’t as clean and well integrated as Python’s implementation, but it’s not as if type annotations in Ruby don’t exist.
- bhaak 3y agoIt does exist but they are not embraced by the majority of the Ruby community. Unless type annotations are treated like first class citizen in the language, it won't be good enough. My theory is that those in the community wanting static types went to Go or Rust.
- nurettin 3y agoOf course anything can be done with RBS, but I think it came wayyy too late. Python type system is already given time to evolve and survive in the wild. A second point is IDE support. It is so hard to get started with ruby auto-format, code completion, ctrl-click to follow code and debug. Python is readily usable in pycharm community edition.
- 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.
- oglop 3y agoTo Ruby’s credit, they foresaw what others bolted on years if not decades after. Remember Python didn’t start with being fully object oriented, everything is not exactly an object, they bolted on the useful functional stuff later (like every language has now after a weird period of people crapping on FP for some reason) and to top it off bundler, and Ruby version manager again were just largely copied over to Python as pip and venv. I like both languages, and I say this after getting schooled a few times about great things I thought Python did that I was a few times rather embarrassingly shown to have just been Ruby ideas picked up by others. I’ll give you the language looks a bit funny and I’m not saying it’s better or anything, I work in Ruby and am all too aware of the warts. Just trying to share what I’ve learned that they did well because it’s a good and thoughtful community.
- wiseowise 3y ago> and to top it off bundler, and Ruby version manager again were just largely copied over to Python as pip and venv. Python’s venv is so much better than whatever Ruby has.
- yxhuvud 3y agoVenv tries to do too much and manages to not be great at anything, which is a direct contributing factor to Python being worst in class by a wide margin when it comes to packaging and dev environments.
- ric2b 3y agoI have the exact opposite experience, bundler + rbenv are so much nicer to use than pip and venv. rbenv automatically loads the correct ruby version when I enter a project directory and bundler is just so much more capable and intuitive than pip.
- oblio 3y agorvm has almost nothing to do with venv, conceptually.
- 3y ago
- bogota 3y agoAnd also produces so much waste since almost no one writing python thinks at all about performance leading to some of the dumbest looking architectures i have seen to scale up to even a small amount of requests.
- oblio 3y agoAnd your counterargument to that is... Ruby?
- deleted 3y ago[deleted]
- realusername 3y agoI never really liked Python much personally, I think it sits at an uncomfortable spot where it's still too verbose compared to other dynamic languages but not performant enough compared to static languages. If I cared more about the expressiveness and the speed of prototyping at the expense of everything else, I would rather use Ruby which has much more stuff built-in and I'd accept to pay the price of its runtime penalty. But if I cared more about performance, I'll rather use a static language like Go or Rust. If I have to pay the dynamic language performance & maintenance tax, it needs to be worth it and I need to get some big advantages in return, otherwise I'd just use Go.
- vidarh 3y agoThe few places I need more performance, I just use FFI and contain the tiny bits needed outside of Ruby. I wrote my MSc on using statistical approached to improve ocr error rates, and 99.9% or so of the code was Ruby - I needed to translate a few dozens of lines of code to C e.g. a knn implementation after I'd proven it worked. In 18 years of Ruby use, this has been typical. E.g. I've done large scale (tens of thousands of layers) map tiles rendering in Ruby, and only a tiny core of the final rasterisation code was worth rewriting even back then at a time when Ruby was far slower.