News for hackers. Stuff that matters.
Re:Ask HN: Why Python over Ruby? by earthboundkid on Thursday July 02, 2009 @06:26AM (#684127)
"As for the whole "5" * 2 vs. 2 * "5", I must admit to not understanding where you're coming from. I don't see how you could expect any other kind of behaviour from an object orientated language."

Python has a __rmult__ method. If you do A * B, first it internally calls A.__mult__(B) then if that raises TypeError, it tries B.__rmult__(A). It's pretty elegant, I think. For Ruby, it wouldn't look as nice to do A.r* though, I guess, but it would be a nice bit of functionality.

There are no comments on this comment yet.