Live data from Hacker News

What Pythonistas Think of Ruby

blog.peepcode.com

21–30 of 247 posts

Re: What Pythonistas Think of Ruby

#21

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…

>Neither python nor ruby are lisp.

You may or may not agree, but you'll probably be interested in Why Ruby is an acceptable Lisp: http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-a...

Covered on HN previously here:

http://news.ycombinator.com/item?id=416589

Re: What Pythonistas Think of Ruby

#22
post #17
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?

Disagree on "REST syntax". Python could do just as well: Sinatra: get '/hi' do "Hello World!" end Python 2: @get('/hi') def hello(): return "Hello World" Python 3: def hello() -> "/hi": return "Hello World"

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...

Re: What Pythonistas Think of Ruby

#24
post #17

Earlier quoted context omitted.

Disagree on "REST syntax". Python could do just as well: Sinatra: get '/hi' do "Hello World!" end Python 2: @get('/hi') def hello(): return "Hello World" Python 3: def hello() -> "/hi": return "Hello World"

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.

Re: What Pythonistas Think of Ruby

#25

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…

And not being Lisp is one of the big reasons for the success of both Python and Ruby. :-)

FLAMEBAIT -> FLAMEBAIT

Re: What Pythonistas Think of Ruby

#26

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…

I wholeheartedly agree that all languages should be judged on the quality of their libraries and implementation, as well as the success of the projects implemented on top of them. Ruby and Python have a pretty good track record there.

One of the themes of Gary's talk was that Ruby is more expressive/flexible than Python, and lisp was thrown into the discussion as sort of a "gold standard" of expressiveness/flexibility, without necessarily passing any judgment on overall merits of the three languages.

To the extent that Ruby strives for more flexibility, it is probably way more influenced by Perl than lisp.

As somebody who has used both Ruby and Python fairly extensively, I think Ruby is undeniably more expressive than Python at times, but also more arcane at others. Some of the differences probably come from irreconcilable tradeoffs, where you cannot have your cake and eat it too, but other tradeoffs are probably less necessary, which is why people continue to discuss it. In the case of Ruby, it's a pretty young language, so there are probably opportunities to make it more appealing to a Python mindset without losing its great flexibility, although I do not have specific proposals.

The conference Gary spoke at was a Python conference, so most people were more interested in ways that Python could learn from Ruby, without sacrificing Pythonicness. Gary seemed to reach the conclusion that the number one feature he envied in Ruby was blocks. Speaking for myself, I wish Python just had some kind of anonymous function syntax that was more rich than lambdas, even if it were not exactly semantically similar to Ruby blocks.

Re: What Pythonistas Think of Ruby

#27

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.

Fair enough. Arguing over beauty is silly anyway, I just wanted to point out that the entire thing is entirely subjective.

> The Python 3 version is using a function annotation.

Thanks, checking out PEP 3107 now. I've always seen annotations done with the @annotation syntax like the Python 2 snippet has.

Re: What Pythonistas Think of Ruby

#29
post #18

Earlier quoted context omitted.

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.

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/

Re: What Pythonistas Think of Ruby

#30
post #17
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?

Disagree on "REST syntax". Python could do just as well: Sinatra: get '/hi' do "Hello World!" end Python 2: @get('/hi') def hello(): return "Hello World" Python 3: def hello() -> "/hi": return "Hello World"

Decorators and annotations are very useful in Python, but I still like the terseness of Ruby--no need to define "hello()". Of course, Python wins on a different kind of terseness--no do/end--but that is mostly orthogonal.
Post reply on HN