The python version seems buggy as fuck. Depending on which year you run it it’s off by 1-3 days
Never worked on Ruby, so I definitely cannot judge it, but that syntax looks so uncomfortable…
It can be nice to read but try debugging something like this is a horrible experience.
I had 5 years of ruby on rails experience before jobs decided on other Lang’s. Its still not terrible persay but it hurts when you have multiple of these “smart” objects doing really silly things and debugging it all.
I programm in Ruby since 2006.
In my opinion it has some of the best debugging tools available.
What was the horrible part you experienced?
For me its auto resolving types. But its been close to 4 years since I’ve touched any ruby. So would love to be proven wrong ;)
Type safety is still optional but now part of the standard library.
Oh god, it’s so bad. It’s like .h files, but worse.
And the best part is the Ruby way accounts for leap years.
I prefer the one on the left because it’s evident it doesn’t account for leap days, while I’d be questioning whether the one on the right does.
I’ll give it a shot. Looks a bit kludgy and I’ve been typing this on my phone while sitting on the toilet. What am I doing with my life?
from datetime import datetime now = datetime.now() year = now.strftime('%Y') month = now.strftime('%m') day = now.strftime('%d') tenyearsago = datetime(year-10, month, day) print(tenyearsago.strftime('%d.%m.%Y')or just this
from datetime import datetime today = datetime.today() ten_years_ago = today.replace(year=today.year - 10) print("Date 10 years ago:", ten_years_ago.date())







