Here is a minimal example:
from typing import Set
def f() -> Set[str]:
xs = set()
xs.update({x for x in ["a", "b"]})
return xs
PyCharm's PyTypeChecker will complain about the function's type signature:
Expected type 'Set[str]', got 'Set[set]' instead
If I replace the set comprehension {x for x in ["a", "b"]} by set value {"a", "b"}, there is no warning.
Why is that so ?
I'm using Python 3.8 and PyCharm 2021.2 Community Edition.