How to replace an instance method?
Eryk Sun
eryksun at gmail.com
Sat Sep 17 21:37:58 EDT 2022
On 9/17/22, Chris Angelico <rosuav at gmail.com> wrote:
>
> A method IS a function. A bound method is a function with one argument
> locked in, but still a function.
We were talking past each other. A method object is not a function
object. You're talking about a function defined in a class that's
accessed as a method of an instance of the class. In the class, that's
just a function object; it's exactly a function, not merely
fundamentally the same thing as one. It's only when accessed as an
attribute of an instance of the type that the function's descriptor
__get__() method is called to bind it and the instance to a method
object that sets the instance as its __self__ and the function as its
__func__.
More information about the Python-list
mailing list