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

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Feb 3 06:58:49 EST 2015


Steven D'Aprano wrote:

> In Python 2, they are methods. In Python 3, they are functions, and aren't
> converted into methods until you access them via the instance:

They're methods in both cases. They don't have to be
"converted into methods"; they already are, by virtue
of their location and intended usage.

The wrapper that gets created on attribute access isn't
the method (despite being called MethodType!) -- the
method is the function that it wraps. The wrapper is
just part of the machinery that passes the self argument
to the method.

-- 
Greg



More information about the Python-list mailing list