Maybe this is a bit funky, but I want to pass a callable instance method as a default variable to an instance method of the same class.
from typing import Callable
class Person:
def __init__(self, name):
self.name = name
def say_hi(self):
print("Hello, my name is", self.name)
def greet(self, func: Callable=say_hi):
func()
p = Person("Guido")
p.greet()
With the above solution self is not passed to the instance method.
Replacing func: Callable=say_hi with func: Callable=self.say_hi and self is not yet defined.
self.say_hi, if you still insist then you can d0p.greet(p.say_hi)