Live data from Hacker News

What Pythonistas Think of Ruby

blog.peepcode.com

161–170 of 247 posts

Re: What Pythonistas Think of Ruby

#161

Earlier quoted context omitted.

Smalltalk is even better. Advanced Smalltalk is morphing Smalltalk into a DSL. You can even write your own domain specific if-then-else analogues, and it looks 1st class like the Standard conditional logic. Yet the implementation is just a plain vanilla method.

You can't morph Smalltalk into a DSL as Smalltalk itself is nothing but a DSL; syntactically every single control structure is library.

I prefer to think of it this way: DSL are syntactic 1st class citizens in Smalltalk. (Not 1st class for optimizations, though)

To say Smalltalk IDS is a bit useless. Sure, if your "domain" is some Turing-complete language.

Re: What Pythonistas Think of Ruby

#162

Earlier quoted context omitted.

That's just another reason for vicious fights besides small stakes, small differences. Just ask the protestants and the catholics.

It is true that small differences can mean large conflicts, but I think Catholicism and Eastern Orthodoxy is a better illustration of this. The only doctrine that the two denominations disagreed on was the exact way in which the Pope is higher-ranked than the other metropolitan bishops; this plus language barriers and differences in cultural atmosphere produced something like 1500 years of mutual hostility which were…

When looking at this from an atheists perspective it looks like very minor differences to me.

There's a joke about that, I looked it up:

I was walking across a bridge one day, and I saw a man standing on the edge, about to jump off. So I ran over and said “Stop! don’t do it!” “Why shouldn’t I?” he said. I said, “Well, there’s so much to live for!” He said, “Like what?”

I said, “Well, are you religious or atheist?” He said, “Religious.”

I said, “Me too! …Are you Christian or Buddhist?” He said, “Christian.”

I said, “Me too! …Are you Catholic or Protestant?” He said, “Protestant.”

I said, “Me too! …Are you Episcopalian or Baptist?” He said, “Baptist!”

I said, “Wow! Me too!…Are you Baptist church of God or Baptist church of the Lord?” He said, “Baptist church of God!”

I said, “Me too! Are you original Baptist church of God, or are you reformed Baptist church of God?” He said, “Reformed Baptist church of God!”

I said, “Me too! Are you reformed Baptist church of God, reformation of 1879, or reformed Baptist church of God, reformation of 1915?”

He said, “Reformed Baptist church of God, reformation of 1915!”

I said, “Die, heretic scum” and pushed him off.. — Emo Phillips

Re: What Pythonistas Think of Ruby

#163

Earlier quoted context omitted.

That's just another reason for vicious fights besides small stakes, small differences. Just ask the protestants and the catholics.

It is true that small differences can mean large conflicts, but I think Catholicism and Eastern Orthodoxy is a better illustration of this. The only doctrine that the two denominations disagreed on was the exact way in which the Pope is higher-ranked than the other metropolitan bishops; this plus language barriers and differences in cultural atmosphere produced something like 1500 years of mutual hostility which were…

@jacquesm: At least from my perspective, "God wants everyone to go to Heaven" and "God wants some people to go to Hell" are further apart than "God wants everyone to go to Heaven" and "there is no God, and the universe developed through chance and emergent patterns."

Calvinism had _huge_ practical consequences -- in social policy, it's the difference between ensuring that the poor are fed and sheltered, and kicking them into the street; and you can only imagine what it meant for the laws of war...

Edit: And the joke you mention is only too recognizable, but it's more like the Catholicism-and-Orthodoxy situation, where it's a matter of tribal loyalties more than views of the world...

Re: What Pythonistas Think of Ruby

#164

Earlier quoted context omitted.

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.

Does this boil down to a case of Worse is Better?

That is a good question, and worthy of an upvote. My first inclination is to say it is not, because if Ruby really were the "worse" to Lisp's "better" in some measurable, objective sense, then presumably Matz would have created something like Clojure rather than Ruby.

Re: What Pythonistas Think of Ruby

#165

Earlier quoted context omitted.

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

I fail to see how that is flame bait. It's actually a quite insightful statement that is worth repeating: Python, Ruby and all other languages exist for a reason. The reason is that other languages, including Lisp, are not considered to be equally useful for the tasks for which a specific language is being used. Python is not only not Lisp: it's not Java, not Haskell, not Erlang, not ... Whether it is a good reason,…

I agree. Lisp just plain looks weird because of all the parentheses and the prefix notation. I also can't help get the feeling that even with macros available to me, coding directly in the form of parse trees just might not be optimal. Also, it makes my head hurt sometimes.

As I sit here writing this, it strikes me that someone who's using these kinds of things to avoid learning Lisp is a lot like the Python newbie who's discovered the language and wanders on to comp.lang.python complaining about the syntactically significant indentation. As with most matters, I'm inclined to believe that Lisp's problem here is primarily a people problem rather than a technical problem.

Re: What Pythonistas Think of Ruby

#166
post #127

Earlier quoted context omitted.

Yep. `yield` in Ruby is a normal anonymous method call. It pushes a new frame onto the stack. `yield` in Python works more like Ruby's [Generator]( http://ruby-doc.org/stdlib/libdoc/generator/rdoc/classes/Gen... ). It freezes the current stack frame's state and resumes execution somewhere else, returning again to the same place on the next iteration. They're very different things really. More about Python's generator…

So what would yield in Ruby be like in Python? Surely there must be some analogue?

Ruby's yield is essentially just calling an anonymous function given to it in the form of a block. e.g., the following code snippets are equivalent

Ruby:

    def foo(bar)
      if block_given?
         yield bar
      end
    end

    foo 5 { |x| puts x } # prints 5
Python:

    def foo(bar,fcn):
        fcn(bar)


    foo(5, lambda x: sys.stdout.write("%d\n" % x))
The only real difference being that the ruby code is calling a block versus a "real" function.

edit Oops, had this page open for a while, didn't realize someone had replied in the interim, making my response somewhat redundant

Re: What Pythonistas Think of Ruby

#167

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…

I think a big reason why it comes up so often is that it's rarely worth the mental real-estate to become proficient in both since they are so similar in design and problem domain. There is significant diminished utility in learning python after knowing ruby or vice versa. You're better of learning something totally different (like haskell!) since you already have a flexible modern scripting language with a great web-…

This right here is the exact reason that I, as a fairly experienced and hopefully pretty good Python programmer feel absolutely no desire to learn Ruby. It doesn't offer me anything in terms of making me think differently about programming than Python, and I don't see any particular domain (other than, of course, Rails) where it offers an advantage in libraries or anything. On the other hand, had I stumbled upon Ruby first and then found out about Python, I'm sure I probably wouldn't feel any need to learn Python, either.

Re: What Pythonistas Think of Ruby

#168

Earlier quoted context omitted.

Ah. So, Python uses the Java annotation syntax for decorators? Hm. One more thing I'll have to look into when I get the time.

Actually, I think Java uses Python decoration syntax for annotations, but I have been wrong before.

I'm pretty sure Python picked it up after Java did. But, I don't think it's a case of imitation; it's just that the glyph '@' happened not to have syntactic meaning attached to it and it looks okay.

Re: What Pythonistas Think of Ruby

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

The prototypical ruby case would be:

  def some_method(x, &block)
    yield x
  end

  then to call it:

  some_method "hey" { |v| print v }
That might not look like much, but it allows you to create methods that can extend the language expressively and then use them without extra crufty syntax or sigils obstructing their meaning.

Re: What Pythonistas Think of Ruby

#170
post #81
post #39

Earlier quoted context omitted.

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

Sayer's Law: "In any dispute the intensity of feeling is inversely proportional to the value of the stakes at issue." http://en.wikipedia.org/wiki/Sayre%27s_Law Special case in programming -- "colour of the bikeshed" http://en.wikipedia.org/wiki/Parkinson%27s_Law_of_Triviality

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 :)

Post reply on HN