Live data from Hacker News

Ruby vs. Python comes down to the for loop (2021)

softwaredoug.com

21–30 of 193 posts

Re: Ruby vs. Python comes down to the for loop (2021)

#21
post #19

Ruby always seems so appealing. Can anybody tell me how the Ruby ecosystem looks like w.r.t. - (Desktop) GUI - Natural language processing I would really like to learn Ruby, but I can only justify the effort if I can use its ecosystems for some private projects, and I often have been burned by languages not offering too much in those two areas. And speed-wise, as I understand, Ruby is the same ball-park as Python?

Ruby is only relevant because of Rails, and if those two things are your use-cases then you’ll be better off with Python

Re: Ruby vs. Python comes down to the for loop (2021)

#22

This is because Ruby inherits it's approach to flow control from Smalltalk, while Python comes from a C/Algol-like heritage. In fact, Smalltalk takes this much further, such that basically all flow control (including if-then-else) is handled as message sends (e.g. if-then is just a message sent to the Boolean object taking a block as it's argument). The downside is the syntax can feel a tad clunky. The upside is incr…

[flagged]

Re: Ruby vs. Python comes down to the for loop (2021)

#23
post #11

I think the article leaves out the main difference in Ruby vs Python. Ruby is built for humans, Python is built for machines. This example used to be illustrated on Ruby on Rail's website. https://rubyonrails.org/doctrine They are philosophical vastly different languages. This isn't to say one is better or worse over the other. Just use the right tool for the job. If I was going to do anything with machine learning o…

> I think the article leaves out the main difference in Ruby vs Python. Ruby is built for humans, Python is built for machines. This example used to be illustrated on Ruby on Rail's website.

> Just use the right tool for the job.

Oh, cut the crap. Both statements have nothing to do with reality. If we go by your definition, there’s no reason for Ruby, because Python will always be righter tools for the job.

Re: Ruby vs. Python comes down to the for loop (2021)

#24
post #2

I've done a lot of SRE work and two stints at companies with RoR stacks. Really have kinda soured on Ruby and Python at this point and it has little to do with loops. If I had to choose though it would be Python for asyncio.

> If I had to choose though it would be Python for asyncio. I can think of lots of reasons to prefer Python over Ruby, but asyncio in Python compared to Ruby’s async is not at all one of them.

What about it?

Re: Ruby vs. Python comes down to the for loop (2021)

#25
post #11

I think the article leaves out the main difference in Ruby vs Python. Ruby is built for humans, Python is built for machines. This example used to be illustrated on Ruby on Rail's website. https://rubyonrails.org/doctrine They are philosophical vastly different languages. This isn't to say one is better or worse over the other. Just use the right tool for the job. If I was going to do anything with machine learning o…

That's ontologically false isn't it? Ruby is built for humans by humans. Python is built for humans by humans. Given that humans use Python to write code that is then readable by machines, then certainly Python is built for humans.

Re: Ruby vs. Python comes down to the for loop (2021)

#26

This is because Ruby inherits it's approach to flow control from Smalltalk, while Python comes from a C/Algol-like heritage. In fact, Smalltalk takes this much further, such that basically all flow control (including if-then-else) is handled as message sends (e.g. if-then is just a message sent to the Boolean object taking a block as it's argument). The downside is the syntax can feel a tad clunky. The upside is incr…

[flagged]

C syntax for say list iteration would be much more cumbersome than "for a in mylist", so there's benefit in diverging from C sometimes.

Funnily, regardless of deeply different implementations, for loops look almost the same in Python and Ruby.

Re: Ruby vs. Python comes down to the for loop (2021)

#27

This is because Ruby inherits it's approach to flow control from Smalltalk, while Python comes from a C/Algol-like heritage. In fact, Smalltalk takes this much further, such that basically all flow control (including if-then-else) is handled as message sends (e.g. if-then is just a message sent to the Boolean object taking a block as it's argument). The downside is the syntax can feel a tad clunky. The upside is incr…

[flagged]

What exactly do you think the purpose of having different programming languages is?

The popularity and usefulness of Ruby’s block-based control flow, which you seem to take issue with, is almost certainly largely responsible for the adoption of lambdas in… basically every modern language, not to mention being backported to existing languages like C# and Java.

Frankly your hot take is terrible. C was an amazing language, but there are an infinite number of practical and effective ways to improve upon it. Particularly having just admitted that you’ve never actually used the syntax in question it’s honestly astonishing that your first instinct is to jump straight to posting about how much better the C approach is.

Hell, you’d be hard-pressed these days to find a modern language that uses C-style `for` loops. They might say `for` on the tin, but they’re much closer to Ruby-style enumerators than they are to C-style setup-condition-increment control flow. With, of course, the caveat that that’s all they ever can be since they’re keyword syntax rather than just a method.

What a sad world this would be if everything interesting in programming was discovered by K&R in the 1970s.

Re: Ruby vs. Python comes down to the for loop (2021)

#28
post #21
post #19

Ruby always seems so appealing. Can anybody tell me how the Ruby ecosystem looks like w.r.t. - (Desktop) GUI - Natural language processing I would really like to learn Ruby, but I can only justify the effort if I can use its ecosystems for some private projects, and I often have been burned by languages not offering too much in those two areas. And speed-wise, as I understand, Ruby is the same ball-park as Python?

Ruby is only relevant because of Rails, and if those two things are your use-cases then you’ll be better off with Python

There is an enormous Ruby ecosystem completely outside of Rails.

Re: Ruby vs. Python comes down to the for loop (2021)

#29
What I like in Ruby: Every expression returns a value. In Python my_list.sort() will return `none`. So if I do `sorted_list = my_list.sort()`, my `sorted_list` will be `none`. And I have been shooting a lot in my foot in the beginning. - I love Python now, but not because I find it aesthetically appealing (I prefer Lisps or functional languages) but because it is ubiquitously available, the ecosystem is phantastic, and it gets the job done.

One rant though: Am I the only one being overwhelmed by so many "end" delimiters in Ruby? Feels like visual noise. end end end end...

Re: Ruby vs. Python comes down to the for loop (2021)

#30
post #21
post #19

Ruby always seems so appealing. Can anybody tell me how the Ruby ecosystem looks like w.r.t. - (Desktop) GUI - Natural language processing I would really like to learn Ruby, but I can only justify the effort if I can use its ecosystems for some private projects, and I often have been burned by languages not offering too much in those two areas. And speed-wise, as I understand, Ruby is the same ball-park as Python?

Ruby is only relevant because of Rails, and if those two things are your use-cases then you’ll be better off with Python

Ruby is an excellent language/platform and you can do a lot more than using Rails. But yes I don't know for NLP.
Post reply on HN