On Thu, Oct 18, 2012 at 12:43 PM, Daniel Urban <urban.d...@gmail.com> wrote:
> The source is usually in Objects/*object.c (e.g., the source for list
> is in Objects/listobject.c, dict is in dictobject.c and so on). The
> implementation of __len__ is usually in a method called
> whatever_length (e.g., dict.__len__ is called dict_length). To be
> sure, you can check the PyTypeObject declaration for the type.
> Probably the tp_as_sequence or tp_as_mapping field contains the
> pointer to __len__ (sq_length or mp_length respectively). (You can
> also search for "lenfunc", which is the type of such functions.)

Many thanks for the details.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to