Live data from Hacker News

What Pythonistas Think of Ruby

blog.peepcode.com

31–40 of 247 posts

Re: What Pythonistas Think of Ruby

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

Not sure what this snippet does, but if it creates a block that is registered as a task named "name", then you can do the same with decorators:

    def task(f):
       register_task(f.__name__, f)
       return f
    
    @task
    def name(t)
       .....
or similar.

Re: What Pythonistas Think of Ruby

#32

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

Yes, i have read that article. Here is my humble opinion: Having 80% of the expressibility, even if you don't need the other 20% that often, does not make you lisp. Which is why the title is not "Why ruby is lisp", but uses the word "acceptable". Its just semantics, and i don't want to argue about what makes something lisp, it wasn't even my main point.

Re: What Pythonistas Think of Ruby

#33

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.

pyparsing, the equivalent of which I haven't seen in any other language

Well the "golden oldie" equivalent in the Perl world is Parse::RecDescent (http://search.cpan.org/dist/Parse-RecDescent/).

A new kid on the block is Regexp::Grammars (http://search.cpan.org/dist/Regexp-Grammars/), which is heavily based on Perl 6 rules/grammar (http://en.wikipedia.org/wiki/Perl_6_rules).

Re: What Pythonistas Think of Ruby

#34
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 the situation isn't changing: most new Ruby "libraries" are just add-ons to Rails, seriously, how many Rails unit testing frameworks, paginators and file upload handlers do we need?

People. Python hackers are much, much nicer folks to hang around with. I don't like to start a war here so I'll refrain from going further with this point. Besides, I feel like Zed Shaw said it all.

Re: What Pythonistas Think of Ruby

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

It's using function annotations as a way to describe which URL to route to. Function annotations aren't used by anything in Python3 by default, so it's one possible way to do that.

Re: What Pythonistas Think of Ruby

#36
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/

that's cool, thanks ... I was wondering about that

Re: What Pythonistas Think of Ruby

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

Re: What Pythonistas Think of Ruby

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

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

Re: What Pythonistas Think of Ruby

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

[deleted]
Post reply on HN