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

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Feb 2 07:09:14 EST 2015


Steven D'Aprano wrote:

> Both K.f and K.g are methods, even though only one meets the definition
> given in the glossary. The glossary is wrong.

Oh I'm sure somebody is going to pick me up on this... 

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:

K.f returns the function f

instance.f typically retrieves the function f from K, and converts it to a
method object bound to instance



-- 
Steven




More information about the Python-list mailing list