title: How can I use a list[customClass] as type with @dataclass in Python 3.7.x
body: <p>I have the following dataclasses.</p>
  
  <pre><code>@dataclass
  class Package:
      '''Class for keeping track of one destination.'''
      _address: []
  
  @dataclass
  class Destination:
  '''Class for keeping track of a destination.'''
  _start: str
  _end: str
  _distance: float
  
  def __init__(self, param):
      self._start = param[0]
      self._end = param[1]
      self._distance = param[2]
  </code></pre>
  
  <p>and the following dataclass that calls the above class.</p>
  
  <pre><code>@dataclass
  class DestinationContainer:
      '''Class for keeping track of a package destination.
         and all the possible combinations of potential next destination '''
      _package: Package
      _destinations: List[Destination]
  
      def __init__(self):
          pass
  
      def addPkg(self,param):
          self._package = param
  </code></pre>
  
  <p>I get the following error when attempt run the program</p>
  
  <blockquote>
    <p>TypeError: Parameters to generic types must be types.</p>
  </blockquote>
  
  <p>I have also tried to call the <code>_destinations</code> member this way.</p>
  
  <pre><code>_destinations: List[Destination] = field(default_factory=list)
  </code></pre>
  
  <p>Then I get the following error</p>
  
  <blockquote>
    <p>TypeError: Parameters to generic types must be types.</p>
  </blockquote>
  
  <p>I have also tried to set the class member as </p>
  
  <pre><code>    _destinations: [] 
  </code></pre>
  
  <p>And upon inspection of the instance object, there is no list available inside the class. </p>
  
  <p>I also tried. </p>
  
  <pre><code>_destinations: List = field(default_factory=lambda: [])
  </code></pre>
  
  <p>and I get the following error when attempted to add to the list </p>
  
  <blockquote>
    <p>AttributeError: 'DestinationContainer' object has no attribute '_destinations'</p>
  </blockquote>