Live data from Hacker News

What Pythonistas Think of Ruby

blog.peepcode.com

191–200 of 247 posts

Re: What Pythonistas Think of Ruby

#191
post #150

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…

As a "battle" I think it is stupid. Otherwise, I disagree with you. They're very different languages. Python is great for people who are accidental programmers or non-programmer programmers, especially ones who think mathematically and analytically. It's popular among scientists and engineers who need to understand a language pretty completely in a top-down way, but who want to waste as few brain cells as possible on…

> Perl is also for dedicated professionals who want a tool that rewards more study and practice with more and more power -- mastery of Perl is a never-ending road with a seemingly never-ending escalation of power and awesomeness.

That sounds more like programming (which you can teach yourself in ten years) than any specific language.

Re: What Pythonistas Think of Ruby

#192

Earlier quoted context omitted.

I have yet to see a Ruby "DSL" that didn't feel like Ruby. That is, unless you.talk :like => "this"

Those are just the "english-y" DSLs. Not all are attempting to read like english. And even for those that are, the point isn't to be writing in english, the point is to be at least halfway readable to a non-programmer reading over your shoulder.

> ... the point is to be at least halfway readable to a non-programmer reading over your shoulder.

That's the same argument for filing the serial number off of TDD and calling it BDD: sometime, somewhere, somehow eventually some non-programmer is going to have to maintain source code without a trained professional programmer around to help.

I don't get it; FIT's been around much, much longer. What kind of non-developer business rule expert can read the punctuation-sprinkled pseudo-English pidgin Ruby spreads around but doesn't know how to manipulate tabular data in a spreadsheet?

Re: What Pythonistas Think of Ruby

#193
post #109

Earlier quoted context omitted.

I don't know. Haskell is quite dogmatic in some ways. The people on the Haskell cafe mailing list don't strike me as rabid fanboys.

You must be joking. People like Dons run or use a blog spidering program for anything that mentions Haskell. In less than 10 minutes after posting anything remotely negative about Haskell, I have a horde of angry fanboys telling me how I am an idiot.

Really, now? I can't say I've ever seen dons be anything other than polite and helpful. Not to mention that he's one of the most knowledgeable Haskell programmers out there, especially on the "practical real world use" front.

Re: What Pythonistas Think of Ruby

#194
post #150

Earlier quoted context omitted.

As a "battle" I think it is stupid. Otherwise, I disagree with you. They're very different languages. Python is great for people who are accidental programmers or non-programmer programmers, especially ones who think mathematically and analytically. It's popular among scientists and engineers who need to understand a language pretty completely in a top-down way, but who want to waste as few brain cells as possible on…

> Perl is also for dedicated professionals who want a tool that rewards more study and practice with more and more power -- mastery of Perl is a never-ending road with a seemingly never-ending escalation of power and awesomeness. That sounds more like programming (which you can teach yourself in ten years) than any specific language.

That's a trite response. Complexity, power, and culture differ between languages. In Perl, people make a game out of doing as much in a single line as possible. Experts do things that are mystifying to a beginner. In Python, an expert would be expected to produce a solution that is comprehensible to a less-expert programmer, spanning however many lines as are necessary. It would be un-Pythonic to write code that a less expert programmer couldn't understand.

Re: What Pythonistas Think of Ruby

#195
post #181

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

They are not what Lisp macros do. True. 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. I…

> I think that part of the problem is that no one (whom I've seen, at least) has explained in a brief, easy to follow manner just what the Lisp macros get you beyond all of the parse tree manipulation, code generation, and "metaprogramming" you can already do with Ruby.

Uh, the stuff you can do with ruby (short of the Ruby2Ruby parse tree generation) is incredibly limited compared to the arbitrary transforms that macros, especially tools like macrolet (lexically scoped macros) and symbol-macrolet (lexically scoped symbol expansion) allow you to do.

Ruby2Ruby lets you do almost arbitrary parse tree transforms, but again it does this at runtime. Unless you specifically architect your program in a somewhat non-rubyish fashion to have a sort of "compile" phase where your transforms are completed.

> Performance, by the way, won't be enough: language implementations are always getting better.

... I say this as a fan of ruby who's made a career out of it for years. Ruby's performance improvements move at a snail's pace. If someone said, "Hey, you can do everything Ruby2Ruby can do, but with 0 performance penalty" then that'd be a huge value add. If you say it isn't, you're being unreasonable. "It is fast enough" is a mantra you can foist off on people who haven't put up production systems on a Merb stack.

Re: What Pythonistas Think of Ruby

#196
post #194

Earlier quoted context omitted.

> Perl is also for dedicated professionals who want a tool that rewards more study and practice with more and more power -- mastery of Perl is a never-ending road with a seemingly never-ending escalation of power and awesomeness. That sounds more like programming (which you can teach yourself in ten years) than any specific language.

That's a trite response. Complexity, power, and culture differ between languages. In Perl, people make a game out of doing as much in a single line as possible. Experts do things that are mystifying to a beginner. In Python, an expert would be expected to produce a solution that is comprehensible to a less-expert programmer, spanning however many lines as are necessary. It would be un-Pythonic to write code that a le…

> It would be un-Pythonic to write code that a less expert programmer couldn't understand.

I assume you have syntactical concerns and syntactical concerns only in mind, as domain knowledge and local style and creative decisions are far more important for maintainability. Even so, I don't believe you. I've seen far too much Python code which uses decorators and generators and list comprehensions to believe that it's un-Pythonic to "write code that a less expert programmer couldn't understand".

Re: What Pythonistas Think of Ruby

#197
post #98
post #26

Earlier quoted context omitted.

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/flexibilit…

> I wish Python just had some kind of anonymous function syntax that was more rich than lambdas A lot of people keep saying this, including the article author, and I'm having trouble understanding why. Lambdas are for "one-liners", functions are for more-liners. Any time you want to write multiple lines in a lambda it's trivial to make it a named function. def listSomeTable(name): print name.center(40, "=") def getWe…

First of all, your objection to anonymous functions with an example that names the function in two different places kind of takes us off topic from the discussion of "anonymous" functions, but I will still respond.

Second of all, multiline-lambdas are already possible in Python, but they are not anonymous functions.

Anonymous functions, as I said, allow for rich syntax; they do not affect the Turing completeness of the language. The context I am speaking of is "expressibility" in the sense of natural language, not whether or not something is expressible at all.

Ruby allows you to do stuff like this fairly naturally:

def process_event_until_timer_expires # check time, then call block only if # timer not expired end

process_events_until_timer_expires { |t, event| puts t fire_event_downstream(event) }

Having an anonymous function here allows you to read from outside in, which is more natural. From the outside, you know you are in some event loop, then you can look inside the block to see the details of how the event are handled. It's really that simple. Not earth-shattering different than Python, just subtly different and more expressive.

I've been using Python for a decade, and Ruby's still overly exotic to me, so I am sympathetic to people that defend the more Pythonic approach. But Ruby does allow for a different kind of expressiveness here.

Javascript also makes heavy use of anonymous functions, and if you use anonymous functions in other languages, you realize that they have value, even if they are occasionally abused and technically unnecessary.

Re: What Pythonistas Think of Ruby

#198
post #30

Earlier quoted context omitted.

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.

And you could use {} instead of do/end, but a Pythonista wouldn't consider that any more terse.

Yep, my mention of do/end or squigglies was just a caveat on the Ruby-is-more-terse-in-this-example statement in the context of anonymous functions or blocks. I wish there was a language that won on both terseness metrics--i.e. a Ruby with indentation or a Python with anonymous functions.

Re: What Pythonistas Think of Ruby

#199
post #181

Earlier quoted context omitted.

They are not what Lisp macros do. True. 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. I…

> I think that part of the problem is that no one (whom I've seen, at least) has explained in a brief, easy to follow manner just what the Lisp macros get you beyond all of the parse tree manipulation, code generation, and "metaprogramming" you can already do with Ruby. Uh, the stuff you can do with ruby (short of the Ruby2Ruby parse tree generation) is incredibly limited compared to the arbitrary transforms that mac…

You're missing the point.

Nothing in your sarcastic "Uh ..." missive makes me or anyone else care about the features you just named. Yes, I know Ruby doesn't have True Lisp Macros. The point is, why should I care? What real-world problem can I not solve elegantly in Ruby because it lacks this language feature?

"It is fast enough" is a mantra you can foist off on people who haven't put up production systems on a Merb stack.

Well, seeing as how I have deployed Merb in production as well, maybe we can discuss the merits without trying to measure egos based on who's deployed what?

Again, my point is that if you can't name a single real world benefit of macros over what's already in Ruby, then why should anyone care how fast they are?

Re: What Pythonistas Think of Ruby

#200
post #170

Earlier quoted context omitted.

Offtopic question: where can I get a hierarchical category/index/guideline to many of these * laws ? I'd like to quotes these cool stuff as well, just need a way to look it up :)

This is pretty close to what you're looking for, I think: http://en.wikipedia.org/wiki/Category:Adages

that's exactly what I am looking for. Thanks
Post reply on HN