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>Åukasz explained how to correct your code. I'll explain why the error message says what it does.</p>

<p><code>list</code> defines <code>__getitem__</code>, true, but that isn't what the error message is complaining about. The error message is saying that <code>type</code> itself, which is the <code>list</code> <em>type's</em> type, doesn't support <code>__getitem__</code>. For <code>list[whatever]</code> to be valid, <code>type</code> would have to define a <code>__getitem__</code> method, not <code>list</code>.</p>

python pycharm