Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can you give me an example of Python readability trumping Ruby?


It's simple, If I don't indent properly - I don't get to run my code in python.

Yes, I know I can make my code look cleaner in Ruby, but I'm lazy. Call me shallow, but sometimes not having to type in blocks and "end" is kind of nice because of the inherent indentation constraint. And that indentation makes it easier to find lexical scope hierarchy easily too (at least for me). YMMV :-)


I think indenting and block syntax are absolutely trivial with any good editor.


You missed my point. I am talking about the code being cleaner to look at in general.


It's just a trade-off. You get cleaner-looking code, which is much trickier to copy off a random web page. The latter might seem trivial, but it's not so simple. In an environment with ubiquitous browsers, many programmers start as copy-pasters. (Just as many of us of earlier generations started out in BASIC.)

I'm not saying this is bad. It just is.


The programmers should hone their tools first, as they are going to be the most important part of their experience. For copy-pasting code, in vim -- surely other editors have similar, highlight the new code (and surrounding code) and hit "=" (equals) key.


If you're trying to copy a non-trivial amount of code from a web page, you're doing it wrong. In 2010, I think sharing code over the internet is a solved problem.


Newbies often try to "do it wrong." I also wrote lots of really horrendous BASIC. It was a learning experience. If you think of tab-soup as a Python newbie right of passage, that's your prerogative.



I don't know if that's tongue in cheek, but as a mainly python programmer i find ruby much more clear regarding operator overloading.


I have to agree. I am also mainly a Python programmer who had dabbled a bit in Ruby, but in the above examples, Ruby is definitely nicer.

I mentioned some of the reasons I stuck with Python here: http://news.ycombinator.com/item?id=1941594

Where _language_ is concerned, I think Ruby is every bit as nice as Python if not nicer.


I think the point of Python's horrible syntax is to make operator overloading so painful that you're less likely to abuse it (cough C++ cough Haskell). Either that or Guido really likes underscores.


It's part of the point. The idea being that when you're doing operator overloading or metaclass hacking there's a simple, easy visual guide.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: