Hacker News new | ask | show | jobs
by dkarapetyan 3384 days ago
Ruby is a much simpler and more aesthetically pleasant language. Python has all sorts of sharp corners. You really should learn both but I think Ruby is a much easier starting point.

Also, a lot of research on dynamic languages is being done with Ruby, e.g. TruffleRuby, JRuby, RubyOMR, and probably a few more I'm forgetting. Each of those projects is an impressive body of work in and of itself that points to Ruby being very alive and well. Oh, almost forgot about MRuby. I don't think there are similar efforts for Python. In some sense Python is much more stagnant these days in terms of innovation at the language level.

4 comments

> Ruby is a much simpler and more aesthetically pleasant language

That is open to disagreement. I will say the same, but of python.

HOWEVER, among the languages that put "aesthetically pleasant" as part of the charm, I think is safe to say that python/ruby are from the top 5.

Any of both will be a good choice using that criteria (and even considering the troubles with BOTH), so in my mind is hard to go "wrong" with any of them. Both have other features that could weight in the choice, but at level of language are more brothers in spirit than enemies.

---

I don't see ruby "killing" python, (I'm more a fan of python, ok?); just for the look of it the niches of both are more defined now.

SADLY, js is what is killing all the other languages in the web space. I wish a better language was the cause, but not, must be the far worse, more terrible, but the NON-choice.

Without any strong feelings for or against a particular language, I suspect Ruby is hurt more by this than Python, at least in the future, on account of being more web-focused. Can people in both communities confirm or deny this (and as I said I'll happily use Ruby in many of my use cases)?

As for JS; what with TypeScript and ES6 (despite the worry of clutter) I can't help but wonder if it's the best non-choice we could have hoped for.

I think that is a side-effect that ruby in rails was ruby in the mind of many, and python was weak at first in web (before django).

In the meantime, python get a lot of love for scientific computing and other stuff, but ruby (and others, I think no even java or .net) not and then get behind in this area.

So now, when the web side have more viable options and ruby is just one of many, the effect of web on ruby is felt more, but python have a good fallback on the rest.

Python have a more diverse portfolio of options ;)

> I think that is a side-effect that ruby in rails was ruby in the mind of many, and python was weak at first in web (before django).

Django was actually released first.

Yeah? Ups!

But Ruby On Rails was more popular, no?

I agree Ruby is visually nicer and more aesthetic (though that will always be subjective), but I'd say it's probably harder for a beginner due to all of the metaprogramming constructs.

Python is also very much not stagnant. Look at all of the major changes and feature additions in Python 3.3, 3.4, 3.5, and now 3.6.

Not just visually. It is also conceptually much more aesthetically pleasant. I still don't know how metaclasses, descriptors, __magic__ methods, multiple inheritance, all the different string formatting schemes, generators/co-routines, etc. work in Python. The amount of stuff you have to learn in Python is a lot more than in Ruby.
> The amount of stuff you have to learn in Python is a lot more than in Ruby.

I couldn't disagree more with this.

Python is pretty thin when you get down to it. Magic methods alone are 80% of the way to knowing how everything in Python works.

Multiple inheritance in Python is way simpler than the two-pronged inheritance scheme of Ruby, where you have both a parent class and modules (which can be loaded either before or after the parent class) to deal with. Want to see what order ancestor classes are applied? `object.__class__.__mro__`. Done.

Meawhile, in Ruby, you can call a function like this - `my_function(a, foo: 1, bar:2)` - and it feels like you're passing keyword parameters... but Ruby doesn't support keyword parameters. Instead, it's implicitly creating a Hash that's getting passed as the second parameter. Even more confusing, every function has an implicit "block" parameter that can be passed to it, and is silently ignored by default.

Ruby has had keyword arguments for a while now: https://robots.thoughtbot.com/ruby-2-keyword-arguments
Interesting - I remember reading a proposal for this, but I've never seen them in production code.
It's odd... I have relatively little Ruby or Python experience, but I have a kind of undefined affection for Ruby but if I'd have to choice at gunpoint I'd go for Python.

I think the reason is that while Ruby does feel more 'pleasant' to me, especially the me that is new to programming, Python feels less vague, and I've grown to hate vagueness in my code.

I'd probably recommend Python to new coders at this point, but for web development I would probably still opt for Ruby on account of Rails and the Rails Tutorial. If there was an equivalent to the latter, I'd go for Python though (suggestions?).

I can't vouch for it myself, but the Django Girls tutorial [1] is the resource I hear recommended most often for learning Django without any prior programming experience.

[1]: https://tutorial.djangogirls.org/en/

> .. but Ruby doesn't support keyword parameters

Your information is outdated, and only applies to Ruby 1.x. Ruby added real keyword arguments in 2.0, and declaration of mandatory keyword arguments in 2.1.

> Python has all sorts of sharp corners

Could you elaborate on that? I've used more Ruby than Python, and I'm aware of the fact that it's often more 'pleasant', but I'm very curious what you can tell me about Python's sharp corners, because even without using it I've been very attracted to the 'explicit over implicit' mantra after being bitten quite a few times by Ruby's ease (quote unquote, perhaps?).

(As in, so far Ruby feels like a good choice in general, but especially to someone new to programming, but I've grown to love explicit over implicit, not to mention functional over non-functional, and so but even without using Python I'm positive I might prefer it. I'd really love to hear what the gotcha's are in that particular ecosystem)

> In some sense Python is much more stagnant these days in terms of innovation at the language level.

Python may be more stagnant and the implementation level (at least, in terms of experiments outside of the main interpreter like the ones you describe for Ruby), but the language itself seems to be advancing much faster than Ruby right now.