title: singledispatchmethod with typing types
body: <p>In Python 3.8 a new decorator for creating polymorphic functions was created, @singledispatchmethod, which redirects Python to the correct implementation of your method depending on the type hints provided.</p>
  <p>However, I don't seem to be able to use complex types from the typing modules, please could you tell me what is wrong with my example?</p>
  <pre class="lang-py prettyprint-override"><code>from typing import List
  from functools import singledispatchmethod
  class test:
      @singledispatchmethod
      def a(self, a):
          return NotImplemented
  
      @a.register
      def _(self, a : str):
          print(type(a))
      
      # Uncomment to run the example
      # @a.register
      # def _(self, a: List[str]):
      #    print(type(a))
  
      def b(self, b: List[str]):
          print(type(b))
  
  test().a([&quot;A&quot;])
  test().b([&quot;A&quot;])
  </code></pre>
  <p>If the comment of the second underscore function is uncommented, the following error occurs with the a function, even tho it doesn't happend with the b one:</p>
  <pre><code>TypeError: Invalid annotation for 'a'. typing.List[str] is not a class.
  </code></pre>
  <p>What am I doing wrong?</p>