News for hackers. Stuff that matters.
Re:Ruby is beautiful (but I'm moving to Python) by masklinn on Sunday November 28, 2010 @02:53PM (#1948099)
> len is a holdover from earlier python

No. len is basically a multimethod.

> (you can define a method __len__ if you want…)

You have to, it's part of the length protocol, `len()` will not work if you don't. Because `len(o)` calls `o.__len__()`). If you start calling underscore-methods directly (outside of a super() access), you're heading for trouble with your coworkers.

There are no comments on this comment yet.