News for hackers. Stuff that matters.
Re:Static types in Python by mixmastamyk on Thursday October 13, 2016 @05:46PM (#12704329)
Nice, how come some of the type names are capitalized? When the builtins are lower-case? e.g.: List compared to list()
Re:Static types in Python by ddfisher on Thursday October 13, 2016 @05:54PM (#12704372)
Good 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.