I have a function in a Python class that adds Interfaces to a list.
def RegisterAsListener(self, inListener):
self.__TransitListeners.append(inListener)
Since i'm not the only one on this project, I don't want somebody calling the RegisterAsListener function with an incorrect data type
Document the function thoroughly, then let incorrect parameters throw exceptions. The user of RegisterAListener
should be able to use the documentation to know what kind of data the function expects, and - if given incorrect parameters - the resulting exception should make it clear what the user of RegisterAListener
did wrong.