News for hackers. Stuff that matters.
Re:What is the most intrusive wart on your favourite program... by bendotc on Sunday December 07, 2008 @11:11PM (#389476)
Python: "Ruby's int.to_f seems much nicer than a built-in function float(int)."

    >>> print float.__class__.__name___
    type
See, "float" is a type. float(int) is a constructor for a floating point number. It's not a magic built-in function, it's just a constructor for type float. Same with int and str. I can't say there's anything wrong with Ruby's int.to_f, but I actually like the Python design better.

Now, as far as len() goes, I agree. It's easy to forget about such troubles, but I definitely wasted a good 10 minutes when I was learning Python trying to figure out what property or method of type list (or str--I don't remember) I should use to get its length.

Re:What is the most intrusive wart on your favourite program... by ROFISH on Monday December 08, 2008 @11:42AM (#389998)
The C code for Fixnum#to_f is quite literally

  fix_to_f(VALUE num) {
    double val;
    val = (double)FIX2LONG(num); //RSHIFTs sign
    return DBL2NUM(val); //Ruby float constructor of C double value
  }
It does the same thing. Ruby, by design, flows left to right instead of nested params. This way you don't have float(user.timestamp) but instead user.timestamp.to_f.