Terry J. Reedy <tjreedy@udel.edu> added the comment: Python-coded functions do not have .__self__.
def f(): pass
f.__self__ ... AttributeError: 'function' object has no attribute '__self__'
Unbound builtin methods, which are simply builtins functions attached to a class, do not have .__self__
list.__len__.__self__ ... AttributeError: 'wrapper_descriptor' object has no attribute '__self__'
So it makes no sense to me that builtin non-method functions should have this attribute. "Built-in methods This is really a different disguise of a built-in function, this time containing an object passed to the C function as an implicit extra argument. An example of a built-in method is alist.append(), assuming alist is a list object. In this case, the special read-only attribute __self__ is set to the object denoted by alist." should have 'method' replaced with 'instance method' as it is only talking about instance methods, as the term is used in the rest of the section. Or this section should be deleted as it duplicates the previous Instance Method section. Or it should be revised to actually discuss unbound builtin methods. ---------- nosy: +terry.reedy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue14003> _______________________________________