Live data from Hacker News

What Pythonistas Think of Ruby

blog.peepcode.com

41–50 of 247 posts

Re: What Pythonistas Think of Ruby

#41

Earlier quoted context omitted.

A Rubyist would argue that that Python 2 syntax is anything but clear. I have no idea what that Python 3 snippet is doing... care to share? That looks like something that's hard to Google...

As a Pythonista I have no idea what the Ruby snippet is doing. Readability depends entirely on context. The Python 3 version is using a function annotation. In Python 2 or 3 you could use a context manager (with statement) to similar effect.

As a Pythonista I have no idea what the Ruby snippet is doing. Readability depends entirely on context.

Oh, come on. You're just disagreeing for effect here.

I've never used Ruby but that snippet is clear as day.

The Python 3 snippet suggests to me that the output would be "/hi" though :)

Re: What Pythonistas Think of Ruby

#42
> Ruby takes full advantage of the Lisp chainsaw.

I always get a little sad and slightly irritated when I hear people say things like this. This is a statement born from ignorance and misunderstanding.

What ruby does to present micro-DSLs are what any language that lets the programmer influence the scope of single dispatch and has a lightweight syntax for function calls can do. They are not what Lisp macros do, and do not even approach all the common "easy" uses cases for macros. Further, they also incur a much larger runtime performance penalty, whereas macros incur none.

Ruby has so many merits on its own. There is no need to drum up nonsense about how it's a "lisp without the parenthesis".

Re: What Pythonistas Think of Ruby

#43
post #18

Earlier quoted context omitted.

Python's answer to blocks tends to be the with statement, so your example would look like with task('name') as t: # do stuff with t It's not really the same; the task object doesn't have control over whether the block is actually run, but sometimes it is sufficient.

You could almost certainly achieve that with the implementation of blocks provided by this package: http://pypi.python.org/pypi/withhacks/

Wow, I've never seen that before. I'm also not sure I'd say a solution that uses bytecode rewriting is really working within the language, but that's a pretty interesting package anyhow.

Re: What Pythonistas Think of Ruby

#44
post #12

"Without powerful blocks and lambdas, you can’t have Rake. You can’t have RSpec. You can’t have Sinatra’s clear REST syntax." Can anyone explain why?

Python doesn't have multiline lambdas, so there is no way to create an api similar to rake's: task :name do |t| # do stuff end I'm not sure what's the closest equivalent syntax you could create in python.

Why do you need lambdas to do this? Why wouldn't an inline function work?

Re: What Pythonistas Think of Ruby

#45

I think this is a good explanation of some of the very real differences between Python and Ruby. The lambda issue is almost enough to get me back to Ruby after switching to Python. I stick with Python mostly because of syntax (especially significant whitespace) and the batteries-included philosophy. I'm also in love with a Python library called pyparsing, the equivalent of which I haven't seen in any other language.

I'm not sure I get the lambda issue. If you want a > 1 line lambda why not just define a function?

    def a(x):
        def b():
           print x
        return b
Not sure what a prototypical ruby usecase would be.

Re: What Pythonistas Think of Ruby

#46
post #37

As someone who did nothing but Rails since 06 (two Rails-powered startups, plus some Rails contracting), allow me to explain why I dumped Ruby/Rails and switched to Python/Pylons. Batteries. Ruby is great, but outside of Rails you are on your own. Even basic things like geometry needs to be coded by hand. Python (and almost anything else) simply destroys Ruby when it comes to generic non-web centric libraries. And th…

Do you really have to switch from one to another? I learned both languages, love them both, and use them both. There's too much hate in the world of programming languages.

Switching between languages based on context is good; you might have a favorite pet language for desktop work, embedded work, iPhone work, and web work. But splitting your brain cells between languages for the same sort of task, in the case web development, isn't very efficient.

I have to do it, for different platforms, but that means I'm constantly switching between design techniques and I can't reuse one body of common code.

It just makes sense to put all your eggs in one basket and make the switch. However, it's important to have a healthy respect for other languages and their pros and cons compared to your own choice.

Re: What Pythonistas Think of Ruby

#47
Python versus Ruby has always struck me as one of the absurd battles ever. The two languages seem to address a very similar space and have broadly similar features sets.

Yes there are points of variation but both seem to work really well. People build cool and useful stuff in both. People are productive in both.

As for me - I personally like the syntax of Python better. That could be because I learnt it first - or it could just be something in me. Who knows?

and who cares...

Re: What Pythonistas Think of Ruby

#48

I am one of those people who accepted the lisp religion of "syntax is evil". I have a descent knowledge of python, and I've read a few ruby tutorials. Neither python nor ruby are lisp. Python is not cool because of generators, list comprehensions, decorators or any other feature. Ruby is not cool because of blocks or monkey patching(im suspicions of anything called MONKEY patching). Ruby and python are cool because o…

Syntax is human. Syntax is ergonomics. A programming language is the bridge between man and machine. Lisp, I would argue, is far more about the machine than the man and that is the simple reason why it's not more popular.

Python was cool before the libraries; that's why those libraries got written in the first place. Lisp has been around forever and is still lacking in libraries and other support.

Re: What Pythonistas Think of Ruby

#49

> Ruby takes full advantage of the Lisp chainsaw. I always get a little sad and slightly irritated when I hear people say things like this. This is a statement born from ignorance and misunderstanding. What ruby does to present micro-DSLs are what any language that lets the programmer influence the scope of single dispatch and has a lightweight syntax for function calls can do. They are not what Lisp macros do, and d…

You might be taking the statement out of context, and you are certainly quoting it out of context (although brevity is appreciated.)

The statement in the talk was made to illustrate the differences between Ruby and Python, and it was not made to suggest that Ruby was replicating all the benefits of Lisp.

Re: What Pythonistas Think of Ruby

#50
post #39
post #37

Earlier quoted context omitted.

Do you really have to switch from one to another? I learned both languages, love them both, and use them both. There's too much hate in the world of programming languages.

The fights are so vicious because the stakes are so small. (Originally said about academics, but works for programmers, too.)

I have the definitive impression that the Pythonistas are more interested in this fighting than most other language cultures.

I might be wrong, but I really can't mention any other group of people trolling Perl discussions. It is the same for Ruby?

It really seems strange for a language which got the name from Monthy Python. (-: Is it some inferiority feelings to environments which are fun? :-)

Post reply on HN