title: Force a function parameter type in Python?
body: <p>I have a function in a Python class that adds Interfaces to a list.</p>
  
  <pre><code>def RegisterAsListener(self, inListener):
      self.__TransitListeners.append(inListener)
  </code></pre>
  
  <p>This is nice, because a class just needs to inherit from said my Interface, grab this object, and register itself for all updates.</p>
  
  <pre><code>class ITransit():
      def TransitUpdate(self, data):
          raise NotImplementedError("You must define this function.")
  </code></pre>
  
  <p>(assuming I made an interface correctly)</p>
  
  <p>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.</p>
  
  <pre><code>def RegisterAsListener(self, IListener inListener):
      self.__TransitListeners.append(inListener)
  </code></pre>
  
  <p>Is there any way to do this?</p>