I was hoping to be able to do this:
class C:
def __init__(self, foo:Callable):
self._foo = foo
class D:
bar:'C' = C(D.ping) # Unresolved reference 'D'
# I also tried this;
# bar:'C' = C(ping) # Unresolved reference 'ping'
def __init__(self):
...
def ping(self, pong:str):
...
I was surprised this didn't work. Is this not possible?
You can obviously do this:
...
class E:
bar:'C' = C(D.ping)
def __init__ ... #etc
This is a very similar question: Calling class staticmethod within the class body?
But perhaps different because they are trying to call a static method, while I am trying to pass it as a parameter.