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.
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.