Live data from Hacker News

What's better about Ruby than Python? - comp.lang.python

groups.google.com

121–129 of 129 posts

Re: What's better about Ruby than Python? - comp.lang.python

#121
post #88
post #40

Earlier quoted context omitted.

In what situation is it actually a good idea to employ a large number of bad programmers, rather than a small number of good ones? We shouldn't be making trade-offs for the sake of bad ideas ;)

There's a distinction to be made between preventing risky behaviour and relying only on a programmer's good judgement to avoid mistakes. Even if your team is solely good programmers there's a lot to be said for discouraging unsafe behaviour by default since anyone can have a bad day, distraction, etc. I view this situation as somewhat analogous to having guards on power tools: even a highly skilled operator doesn't w…

The nice thing about code is that (when version controlled) all mistakes can be fixed retroactively. As long as two programmers aren't having a bad day at once, pairing will catch "all" errors. As long as all your programmers aren't having a bad day at once, code review will catch "all" errors again. ;)

Re: What's better about Ruby than Python? - comp.lang.python

#122

Earlier quoted context omitted.

> The other thing is that Python has no concept of context Rather, I'd say that part of the zen of python is: implicit is better than explicit , and I prefer python's behavior in this instance.

You've got that backwards for Python: Explicit is better than implicit.

doh!

Re: What's better about Ruby than Python? - comp.lang.python

#123
post #121
post #88

Earlier quoted context omitted.

There's a distinction to be made between preventing risky behaviour and relying only on a programmer's good judgement to avoid mistakes. Even if your team is solely good programmers there's a lot to be said for discouraging unsafe behaviour by default since anyone can have a bad day, distraction, etc. I view this situation as somewhat analogous to having guards on power tools: even a highly skilled operator doesn't w…

The nice thing about code is that (when version controlled) all mistakes can be fixed retroactively. As long as two programmers aren't having a bad day at once, pairing will catch "all" errors. As long as all your programmers aren't having a bad day at once, code review will catch "all" errors again. ;)

This is why you need to automate peer review http://www.parasoft.com

Re: What's better about Ruby than Python? - comp.lang.python

#124
post #108
post #16

Earlier quoted context omitted.

and so much harder for me to maintain someone else's scala code. It feels like statically typed perl, but that's just mho.

At least with version 2.7, I actually really enjoyed looking at the Scala standard library code when the documentation wasn't sufficient for my needs. That's no knock on the scala documentation either, as I frequently look at the JDK standard library source code too. I've also had a couple of similarly positive experiences digging around the Lift code. What other "someone else's" Scala code have you actually had to l…

it's been a while so I don't remember the specifics but it was code for dealing with json in a lift code base.

Re: What's better about Ruby than Python? - comp.lang.python

#125
For me, the biggest difference between Ruby and Python is that Ruby is more perlish (i.e. more hacker, one liners, clever stuff) while Python is cleaner but a bit more verbose and less clever. So in that sens, when I want to hack something, I usually go with Ruby.. but for a big project, I'd prefer Python.

(But these days, I'm mostly hacking with Arc :p)

Re: What's better about Ruby than Python? - comp.lang.python

#126
post #91

Earlier quoted context omitted.

If you have __len__() implemented on the object, why not call it directly? If you are dealing with object X, that is of classes A,B,C or D (that all implement __len__), I don't see the fundamental difference between len(X) and X.__len__().

The "magic methods" wrapped in in double-underscores are special because other parts of the language's syntax rely on them always meaning the same thing. (Some room for programmer misbehavior here.) Example: If __len__ is defined on an object x, and __nonzero__ (Py2) or __bool__ (Py3) is not defined, then "not x" will test if x.__len__() == 0. Similarly, __contains__ interacts with "foo in x", and __eq__ and __hash__…

I've been puzzled by len() and company for a long time and this is the most complete and sensible explanation I've heard. Thank you.

I still think it's the wrong design, mind you, but I no longer think it's a crazy one.

Re: What's better about Ruby than Python? - comp.lang.python

#127

The title made me nervous that this would be run-of-the-mill fanboy garbage. But I trust the author (Alex Martelli), so I read it, and I'm glad I did. It's reasonable and sane. My two big take-away points: 1) It's very nearly a wash. Ruby and Python are so close together (beneath any superficial differences) that distinguishing is almost an exercise in futility. 2) The key thing about Ruby he doesn't like is its "TOT…

My impression of the Ruby community, especially the OSS part of it, was that they were explicitly more about tinkering than enterprise. Certainly characters like _why were in that camp. In regards to monkey-patching, while I'm not a Ruby programmer by any means, I sorely feel its absence in other languages. It's in JavaScript (expando objects as well as being able to override and overwrite built-in methods of existin…

C# (by .NET 4) now has real expando objects, if you really need them. It uses what they call the Dynamic Language Runtime: http://msdn.microsoft.com/en-us/library/system.dynamic.expan...

Re: What's better about Ruby than Python? - comp.lang.python

#128
post #85
post #54

Earlier quoted context omitted.

Are you actually passing around methods in Ruby and, if so, why? As I've pointing out in the past ( http://news.ycombinator.com/item?id=1141245 ), passing around methods is very rare in Ruby due to the flexibility of Procs.

Interesting! I am a half-breed; I write Python at my day job and Ruby in my personal projects. You seem to be suggesting that I am sort of making a mountain out of a molehill. Can you perhaps elaborate on this? I have definitely felt this pain before; I'm not just complaining about it because I "like the Python way more." But if I'm not using Ruby "as intended," I would like to know how I should be using it instead!…

If you have a method that in python would take a function as a parameter then it usually will be passed as a block in ruby.

This doesn't really work if you would want to pass several procs into a method, but honestly, that is not very common.

Re: What's better about Ruby than Python? - comp.lang.python

#129
post #55
post #30

Earlier quoted context omitted.

We run probably one of the largest Ruby production systems that has ever been made and the dynamism and "monkey patching" are used daily to skillfully make the language better and better over time for the tasks that we solve. It's absolutely crucial to teams that internalize it's power and pitfalls.

I was about to ask if you work for Twitter, but then I read your bio. I like Shopify, all the shops built with it look real slick.

Oh, and I like delayed_job as well.
Post reply on HN