I have a function in a Python class that adds Interfaces to a list.
def RegisterAsListener(self, inListener):
self.__TransitListeners.append(inListener)
This is nice, because a class just needs to inherit from said my Interface, grab this object, and register itself for all updates.
class ITransit():
def TransitUpdate(self, data):
raise NotImplementedError("You must define this function.")
(assuming I made an interface correctly)
Since i'm not the only one on this project, I don't want somebody calling the RegisterAsListener function with an incorrect data type. I could put in code to check the type within the register function, but it would be easier all around if the compiler just yelled at the programmer when they try to shove in an incorrect data type.
def RegisterAsListener(self, IListener inListener):
self.__TransitListeners.append(inListener)
Is there any way to do this?