dunder-docs (was Python is DOOMED! Again!)

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Feb 4 01:22:24 EST 2015


Steven D'Aprano wrote:
> I'm arguing with those who insist that objects of type MethodType aren't 
> methods, and objects of type FunctionType aren't functions but methods, 
> except when they are, based on that simplified, incomplete glossary entry.

I'm not arguing that based on the glossary entry. I'm
arguing it based on my experience of how the term 'method'
is used in the Python community.

 > I can inject methods into a class or even an instance. If you
> think that methods *must* be defined in the class body, you're missing out 
> on a very powerful technique.

I'm willing to accept 'method' as a legitimate term for
a function injected into a class body, *if it's used
as a method* once it gets there.

This is what you don't seem to understand. It's not
about the type of the object. You can't write a piece
of code to test whether a given object is a method or
not, because it's not an intrinsic property of the
object. It's a matter of how it's *used*.

-- 
Greg



More information about the Python-list mailing list