On 9/28/2012 2:02 PM, Prasad, Ramit wrote:

Just to make sure I am following, if you call
foo.__len__() it goes to the instance code while
if you do len(foo) it will go to class.__len__()?

len(foo) calls someclass.__len__(foo) where someclass is foo.__class__or some superclass.

If so, why?

Efficiency and perhaps simpler implementation, especially for binary ops.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to