Pycharm: Type hint list of items
<p>My question is different because I made a mistake using type hint.</p>

<p>I found a weird type hinging in pycharm:
<a href="http://i.stack.imgur.com/KFi0B.png" rel="nofollow"><img src="http://i.stack.imgur.com/KFi0B.png" alt="enter image description here"></a></p>

<p><code>Example</code> is my own class. But I guess this is less important because the IDE is complaining about <code>list</code> type does not define <code>__getitem__</code> method which is no true. I'm wondering if it's a bug or I used it in a wrong way.</p>

<p>Accoring to <a href="https://www.python.org/dev/peps/pep-0484/">official PEP</a> to denote list of objects you should use <code>typing.List</code>, not <code>list</code> builtin.</p>

<pre><code>from typing import List


class Something:
    pass


def f(seq: List[Something]):  # no warning
    for o in seq:
        print(o)
</code></pre>

python pycharm