The following seems not to be valid in python 3:
class A:
callback = A.callback_function
def callback_function(self):
pass
You’ll get an error saying type ‘A’ is not defined. Is it because ‘A’ cannot be refered to in it self? Is there anyway I can achieve this type of functionality?
What I’m trying to do is something like this: I have a base class:
class Base:
callback = Base.ignore
def ignore(self):
pass
def some_other_function(self):
self.callback()
In a subclass I’d like to set another callback function:
class Derived(Base):
callback = Derived.special_function
def special_function(self):
do_stuff()
Well, you can just name your function
callback, and it’ll be just the same, but if you really insist on this way: