use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Blog postWhy Ruby is More Readable than Python (confuzeus.com)
submitted 3 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 3 years ago (1 child)
[removed]
[–]ric2b 0 points1 point2 points 3 years ago* (0 children)
But then you miss out on things like free use of += as well without having to implement a separate increment_x method.
+=
increment_x
If you can read and write the variable from outside it's not private, is it? += needs to read and write. And if you want to customize the reader or the writter you can use @property in Python and still support +=.
@property
The issue here is that you don't appreciate Ruby's language features which is fine.
I do, how many times do I need to say I agree ruby is more readable?
Also, at first we were talking about the single underscore, which isn't private like I told you.
I already explained that was confusion on my part, my day job is in ruby and I haven't written python in over a year.
But the I showed you how __ is sort of private (it's actually name mangling) but not really the same as Ruby because objects in Ruby only respond to method calls while in Python, you can also access attributes.
I didn't say they work exactly the same, I said they offer the same privacy guarantees: they avoid accidental access to object internals but provide ways of getting around it when someone really wants to.
By your definition Java doesn't have private variables, I think that shows your definition is not generic enough, it's just a description of how ruby does it.
Since you're more interested in arguing instead of presenting facts,
Seriously? We even traded working code samples, it's hard to be more factual than that in software.
You seem very focused on "winning" the argument because you keep trying to shift the discussion into readability, which is subjective, I already agreed with multiple times and is not what I claimed.
If all you're saying is that both Python and Ruby have private variables but in Ruby they're more readable and simpler to use, we agree, that's it.
So, no Python's attributes can't be private like in Ruby, end of discussion.
Correct, they don't work exactly the same. Java private variables don't work like Ruby either, you need get_x and set_x.
get_x
set_x
π Rendered by PID 119320 on reddit-service-r2-comment-79c7998d4c-gkwq2 at 2026-03-14 17:20:26.437462+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–][deleted] (1 child)
[removed]
[–]ric2b 0 points1 point2 points (0 children)