News for hackers. Stuff that matters.
Re:Ask HN: Why Python over Ruby? by wildjim on Wednesday July 01, 2009 @10:55AM (#682728)
Re: "5" 2 == "55" vs. 2 * "5" == Exception*

You need to remember that EVERYTHING is an object, there are no basic/literal types at all; in this case, "5" is really just syntactic sugar for creating a "5" String object, 2 is syntactic sugar for creating the "2" Integer (Number?) object, and the " * " operator is syntactic sugar for the " * " method of the "5" String object == ' "5".times(2) ' (which is similar to Perl's ' "5" x 2 ' construct).

The String class supports a " * " method which creates n copies of it's string value, and concat's them together into a new String object, but the Integer class does not.

Many "basic" objects have explicit conversion methods, but will also frequently support implicit conversion where it makes sense.

Re:Ask HN: Why Python over Ruby? by akho on Tuesday July 14, 2009 @03:33PM (#704427)
Why does it overload "*" on the right, but not on the left side of the string? Python has __rmult__, and it works. Please do not try to make language warts look better by spilling a bucket of architectural-astronauty crap.