spacegoing spacegoing - 8 months ago 67
Python Question

Pycharm: Type hint list of items

My question is different because I made a mistake using type hint.

I found a weird type hinging in pycharm:
enter image description here

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


Accoring to official PEP to denote list of objects you should use typing.List, not list builtin.

from typing import List

class Something:

def f(seq: List[Something]):  # no warning
    for o in seq: