Live data from Hacker News

What Pythonistas Think of Ruby

blog.peepcode.com

11–20 of 247 posts

Re: What Pythonistas Think of Ruby

#11
post #3

Earlier quoted context omitted.

As an aside, pyparsing is based strongly on the excellent "Parsec" library for Haskell. A number of other languages have similar parser combinator libraries. If you're looking for Ruby libraries specifically, check out: http://treetop.rubyforge.org/ (Treetop uses PEGs rather than parser combinators, but like pyparsing it integrates very well with its host language.)

Good call on Parsec. Unfortunately, I haven't found Haskell nearly as practical as Python for day-to-day work. Treetop I had not heard of. It looks interesting.

The only problem I had with Treetop when I tried to play around with it is the same problem that I tend to have with lots of Ruby libraries. No docs other than code. Treetop has docs, but they were kind of sparse last time I looked at them.

Re: What Pythonistas Think of Ruby

#14
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 of really cool libraries and the way people use these languages, not because they have especially well designed syntax.

Instead of arguing about how cool your crappy syntax is, argue about which has the better libraries, which implementation is better, which is used for cooler projects. Non of these languages can top lisp when it comes to expressiveness and flexibility.

Re: What Pythonistas Think of Ruby

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

Re: What Pythonistas Think of Ruby

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

Re: What Pythonistas Think of Ruby

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

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.
Post reply on HN