3 ms·
Nice, how come some of the type names are capitalized? When the builtins are lower-case? e.g.: List compared to list()
by mixmastamyk 10y ago
Nice, how come some of the type names are capitalized? When the builtins are lower-case? e.g.: List compared to list()
- ddfisher 10y agoGood question! There are separate capitalized types for List, Dict, etc provided as part of the `typing` module in order to let you specify element types. Types are all normal Python expressions, so if you wrote `list[int]` you'd get a runtime error, because `type` objects (i.e. the `list` class) aren't subscriptable.