Author terry.reedy
Recipients SpecLad, docs@python, michael.foord, r.david.murray, terry.reedy
Date 2012-02-17.23:02:55
SpamBayes Score 7.34677e-10
Marked as misclassified No
Message-id <>
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.
Date User Action Args
2012-02-17 23:02:55terry.reedysetrecipients: + terry.reedy, r.david.murray, michael.foord, docs@python, SpecLad
2012-02-17 23:02:55terry.reedysetmessageid: <>
2012-02-17 23:02:55terry.reedylinkissue14003 messages
2012-02-17 23:02:55terry.reedycreate