from typing import List, Union
stuff: List[Union[int, str, bool]] = ["Surush", "Mary", "Table",
True, False, "Sam",
99, 20, "TV", "Radio"]
print(stuff)
stuff: List[Union[int, str]] = ["Surush", "Mary", "Table",
True, False, "Sam",
99, 20, "TV", "Radio"]
print(stuff)
stuff: List[int] = ["Surush", "Mary", "Table",
True, False, "Sam",
99, 20, "TV", "Radio"]
print(stuff)
Pyright supports various configuration settings that control the strictness level of type checking. It defaults to less strictness. For the above case, you can enable "strictListInference" to flag this error.
You can also enable "strict" mode, which enables all strict checks. This can be done on a per-file basis (by adding the comment " # pyright: strict" to the top of the file) or for entire subdirectories (by adding an array of directories to a "strict" section in the configuration file).
For a full list of available configuration options, refer to this documentation page.
Fantastic, thank you for the education Eric:). Sorry for the spam. Did as you described and looking great now:)
Most helpful comment
For a full list of available configuration options, refer to this documentation page.