title: Dynamic class level type hints in python?
body: <p>I'm trying to provide type hinting in PyCharm dynamically for a specific class, meaning that one of its attributes has assigned a value during <code>__init__</code>, which on its turn is an object.</p>
  
  <p>I've tried defining a class level type for the attribute, however the type of the attribute could be one of multiple classes, so I can't really point towards a specific type, but I would want to be able to have auto-complete on that attribute.</p>
  
  <pre><code>class Dynamic:
      def __init__(self):
          self.field1 = "field1"
          self.field2 = "field2"
  
  
  class Reusable:
      def __init__(self, dynamics=None):
          if dynamics:
              self.values = dynamics
          else:
              self.values = "nothing"
  
  
  dynamic_test = Dynamic()
  test = Reusable(dynamics=dynamic_test)
  print(test.values.)  # this is the place where auto-complete should take place
  </code></pre>
  
  <p>Obviously, the auto-complete does not take place. 
  I tried things similar to </p>
  
  <pre><code>class Reusable:
      value_type = str  # type to-be-modified later
      values: value_type
  
      def __init__(self, dynamics=None):
          if dynamics:
              self.values = dynamics
          else:
              self.values = "nothing"
          Reusable.value_type = type(self.values)  # doesn't actually modify that so I won't have auto-complete based on type
  </code></pre>
  
  <p>I know that there's some possibilities involving handling the builtin <code>__dir__</code> function, however I haven't gotten any luck with that either (not sure if dependent on PyCharm's auto-complete algorithm or not), nor any plugins have been developed in this direction.</p>
  
  <p>Is there any way I can go around this one and have that auto-complete feature in this case?</p>