5 ms·
Mypy (Python) does this as well. VSCode and PyCharm provide typehints after if isinstance(foo, str): # code
by PartiallyTyped 4y ago
Mypy (Python) does this as well. VSCode and PyCharm provide typehints after
if isinstance(foo, str):
# code
- dehrmann 4y agoSometimes. If foo isn't local scope, this won't work because it could be modified in another thread.
- cwalv 4y agoI used to find the workaround pretty jarring: lfoo = nonlocal_foo if isinstance(lfoo, ...): Since the checker is correct in these cases, I accepted the ugly and got used to it pretty quickly