Hacker News new | ask | show | jobs
by Jagerbizzle 753 days ago
I’ve been a C++ dev for a couple of decades and know my fair share of unreadable code. I’ve recently started learning Python and holy shit, it’s like you get accolades in this language for doing as much as possible in as few characters as possible. Guess I’m getting too old for these young whippersnappers.
2 comments

If you think Python is like that, I advise you to never look at Ruby codebase.

But seriously, of course you can write Python one-liners or nested comprehensions, but I get the idea that it's not really Pythonic. They still want clear, iterative code. It's just more concise, but the idea is the same, but with less scrolling.

> If you think Python is like that, I advise you to never look at Ruby codebase.

Like any other language you can write perfectly expressive and intelligible code in Ruby, and in fact it is quite common to do so. The first layer of a Ruby codebase tends to be approachable, it's only when you get into some of the bigger libraries that you get some tricky metaprogramming.

Even then I don't often see Rubyists write tricky/clever code for the sake of it. The metaprogramming usually has utility and is often the "right" way to do something, especially in say the Rails codebase.

Ruby is all about developer happiness. It's the founding principle and the guiding ethos of the community.

I don't think they're talking about Ruby code golf.

Another way of stating the GP's comment is that a Rubyist looking at a Python codebase will be shocked at all of the verbose boilerplate. Ditto for a Pythonista looking at C++ code.

    If you think Python is like that, I advise you to 
    never look at Ruby codebase.
The codebase for Ruby itself, or the codebase of your typical Ruby app or library?

I spent about a decade with Ruby and my general impression is that the community really moved away from overly-clever metaprogramming.

The codebase for the Ruby language itself is definitely a challenging read.

After spending six months with Python so far, the problem with the Python ecosystem is that you have a lot of really smart people (scientists, mathematicians) who are not software engineers by trade writing a lot of these libraries.

I guess it's a good problem to have, in a lot of ways, because it's also why Python has that huge science/datascience/etc ecosystem.