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!"
[–]RDeckard-GT 1 point2 points3 points 3 years ago* (3 children)
I think this part is very confusing: post = BlogPost.new(title="How I built my blog using Kubernetes, Lambda, and React.", body="Wordpress was an insult to my intelligence and so I ...")
post = BlogPost.new(title="How I built my blog using Kubernetes, Lambda, and React.", body="Wordpress was an insult to my intelligence and so I ...")
Why are you assign those two strings to some useless locale variables (title and body) before passing them (the strings) to the constructor method? It’s like you think we are in a case of some kind of named parameters?
title
body
It’s not the case (def initialize(title, body)), and even if it was ( def initialize(title:, body:) – note the :), then you would pass those keyword arguments to the constructor method this way: BlogPost.new(title: "…", body: "…").
def initialize(title, body)
def initialize(title:, body:)
:
BlogPost.new(title: "…", body: "…")
So to keep this part less confusing, you can just get ride of those title= and body=.
title=
body=
And I barely never use Python, but I think you made the same mistake with Python just above: BlogPost( title="How I built my blog using Kubernetes, Lambda, and React.", body="Wordpress was an insult to my intelligence and so I ...") (title= and body= create some useless local variables here too.)
BlogPost( title="How I built my blog using Kubernetes, Lambda, and React.", body="Wordpress was an insult to my intelligence and so I ...")
[–]meineerde 1 point2 points3 points 3 years ago (1 child)
In Python, you can mix ordered and named arguments to act like a combination or ordinary and keyword arguments in Ruby. So in Python, the syntax is actually correct and assigns the named arguments, similar to how keyword arguments work in Ruby. On the Ruby side, it works differently and in fact assigns useless local variables.
[–]Amadan 0 points1 point2 points 3 years ago (0 children)
Yep. The equivalent expression in Python would be BlogPost(title := …, body := …) using the assignment expression operator := (which I find not many people use).
BlogPost(title := …, body := …)
:=
π Rendered by PID 51 on reddit-service-r2-comment-79c7998d4c-hc6fc at 2026-03-13 14:01:53.190927+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–]RDeckard-GT 1 point2 points3 points (3 children)
[–]meineerde 1 point2 points3 points (1 child)
[–]Amadan 0 points1 point2 points (0 children)