title: What is the correct way to type hint a homogenous Queue in Python3.6 (especially for PyCharm)?
body: <p>I'm writing a fractal generator in Python 3.6, and I use <code>multiprocessing.Queue</code>s to pass messages from the main thread to the workers. This is what I've tried so far, but PyCharm doesn't seem to be able to infer attribute types for items taken from the queues:</p>
  
  <pre><code>from typing import NamedTuple, Any, Generic, TypeVar, Tuple
  from multiprocessing import Process, Queue
  
  T = TypeVar()
  
  
  class Message(NamedTuple):
      method: str
      id: str
      data: Any = None
  
  
  class TypedQueue(Generic[T]):
      def get(self) -&gt; T:
          ...
      def put(self, m: T) -&gt; None:
          ...
  
  
  MessageQ = TypedQueue[Message]
  
  
  class FractalWorker(Process):
      def __init__(self, work: MessageQ, results: MessageQ)
          super().__init__()
          self.work = work
          self.results = results
  
      @staticmethod
      def make_queues() -&gt; Tuple[MessageQ, MessageQ]:
          work = cast(MessageQ, Queue())
          results = cast(MessageQ, Queue())
          return work, results
  </code></pre>
  
  <p>I want PyCharm to be able to tell that the attributes of the result of <code>self.work.get</code> have the types specified by the <code>Message</code> class. I also want to know if there is a standard way of type hinting Queues similar to this.</p>