Live data from Hacker News

Why Ruby Is More Readable Than Python

confuzeus.com

121–130 of 149 posts

Re: Why Ruby Is More Readable Than Python

#121
post #99

Earlier quoted context omitted.

> It's a bit of a weird take when attribute definition in Ruby also uses at signs specifically. No that’s instance variables. > Which part do you find ugly? In Ruby to modify a method you just call a method. I guess I think a second, redundant, way to call methods is not elegant.

In Ruby if else is not a method for some reason also blocks are not objects for some reason "seems inelegant"

> In Ruby if else is not a method for some reason

This is because there’s not a good way to pass two delayed computations - two blocks. Looping constructs were replaced by method variants.

> also blocks are not objects for some reason

Yeah they’re reifiable but not sure why not reified by default.

Re: Why Ruby Is More Readable Than Python

#122

Interesting. Even with the examples given, I found Python considerably easier to follow, with the possible exception of the inheritance example. Just goes to show how subjective it all is!

Same. The amount of boilerplate and "unnecessary" symbols in Ruby make it considerably less readable to me. The Python examples aren't just readable, they're glanceable.

Re: Why Ruby Is More Readable Than Python

#123

Moving to Python from Ruby, one very early scarring experience was battling trying to get the length of a string, before eventually discovering len() - a free function, whereas in Ruby (OO purist that it is), everything is a method. Well I thought this was rather silly and counterintuitive of Python, and said so in some forum or other, whereupon i discovered the very passionate views of folks who have come down hard…

> was battling trying to get the length of a string This makes it sound like you where trying to learn the language by typing in random stuff and just hoping something runs. Yes every language will leave you scared if your path to learning it doesn’t even involve reading a single page about its most basic functioning.

What an extraordinarily patronising response !

Firstly, not 'scared', 'scarred' - merely a bit of harmless hyperbole to indicate a briefly frustrating situation.

Secondly, this is not monkeys-at-typewriters, merely an expectation that Python would conform to any other object-based language and have a public method on string to report its length. This should be a discoverable, not an RTFM case.

Re: Why Ruby Is More Readable Than Python

#124
Years ago, I tried to teach myself Ruby because Rails was all the rage.

But I could not, for the life of me, remember which symbol means private, which meant protected, which meant public. There was no affordance to the symbols, and I have never seen any other OOP language that does that.

And then I moved on to Python and Django, and found the lack of real private/protected/public in the Python world utterly liberating. The more I programmed in Python, the more I appreciated “we’re all consenting adults”.

The more I thought about it, the less reason I find in trying hide anything via protected/private. For example, if I understand correctly, in .NET/Java, anybody with enough determination (and runtime permission) can use your protected/private stuff via reflection anyway.

Re: Why Ruby Is More Readable Than Python

#125

Earlier quoted context omitted.

> I chalk that up to the higher pain threshold for doing really obnoxious metaprogramming in Python If you're going to quote it, don't you think you should quote the whole thing? The whole point of making the pain threshold higher for certain kinds of metaprogramming painful and obvious. I think that is a good thing. You can use it when you need to, but when it comes up in a code review, it's extremely obvious that y…

The important thing for me is that the pain is by design. That someone thinks it’s good for me doesn’t justify the deliberate application of pain to me. I don’t mind that “it works on your machine.” My distaste for Python’s philosophy is my distaste. I simply think my life is richer without aspirations to be Pythonic. And now I can put my finger on why. Thanks.

[deleted]

Re: Why Ruby Is More Readable Than Python

#126

Earlier quoted context omitted.

I get this, and I've started to write this way, because it gets a better response; but it feels to me like it's designed to maximize an emotional response and not a cognitive response, and find I have less trust in people who write this way (Which is most things, i get) I do wonder how this style of writing has impacted the psychology of argument, I imagine there are others who read this style of writing and assume i…

I have to say I appreciated but also laughed at the sheer number of the qualifiers you're discussing in your post... "it feels to me", "I find I", "I do wonder", "I imagine", "this may" I find it makes for less combative discussions. So I like it.

“Yeah? Well, you know, that's just like uh, your opinion, man.”

Re: Why Ruby Is More Readable Than Python

#127

Earlier quoted context omitted.

I have to say I appreciated but also laughed at the sheer number of the qualifiers you're discussing in your post... "it feels to me", "I find I", "I do wonder", "I imagine", "this may" I find it makes for less combative discussions. So I like it.

I'd say that these qualifiers are much more useful in informal communication, like HN, and inappropriate for long-form stuff like essays. Essays are longer, more coherent, and denser.

I think it’s more distasteful in the modern clickbait blog world then more intellectual and well thought out books/essays/etc, where your perspective is not designed for a purely emotional response.

Re: Why Ruby Is More Readable Than Python

#128
post #69

Earlier quoted context omitted.

It's a bit of a weird take when attribute definition in Ruby also uses at signs specifically. Which part do you find ugly?

> It's a bit of a weird take when attribute definition in Ruby also uses at signs specifically. No that’s instance variables. > Which part do you find ugly? In Ruby to modify a method you just call a method. I guess I think a second, redundant, way to call methods is not elegant.

Instance variables != attributes? If that's the case what do you call "attribute"?

Re: Why Ruby Is More Readable Than Python

#129

With better unicodes I wish computer language could use fancier characters to express loops, conditionals and in general without using the english language. goodbye to [if, else, switch, break, lastly, each etc..] let us crate a language that uses no letters but unicode symbols to express abstractions. Like emojis.

You can use Emojicode [0] if you'd like. I'd rather keep using Ruby, Go, Python, etc but to each their own. [0] https://www.emojicode.org/

It makes sense to go the emoji way. We already get emojis on our IDEs with lightbulbs, lightnings and the dreaded red x mark.

Re: Why Ruby Is More Readable Than Python

#130
post #128

Earlier quoted context omitted.

> It's a bit of a weird take when attribute definition in Ruby also uses at signs specifically. No that’s instance variables. > Which part do you find ugly? In Ruby to modify a method you just call a method. I guess I think a second, redundant, way to call methods is not elegant.

Instance variables != attributes? If that's the case what do you call "attribute"?

Attributes are an interface - a getter and setter method with predictable names. They can be implemented with instance variables as the underlying storage, but they don't have to be.
Post reply on HN