Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, `list` and friends were functions to construct those objects. So presumably they did it this way to prioritize adding typing over getting it perfect.

I think it was the right choice.



It was a problem only because somehow they decided that type annotations should evaluate to something meaningful at runtime, instead of being a compile-time only construct like in every other language.


"Somehow they decided" is rooted in the desire to make typing optional, and absolutely not a requirement.


Wouldn't compiler selective enforcement achieve the same goal? It seems to me the difference is that other programs can be implemented to do the typechecking (eg mypy) rather than the compiler doing so itself


It lets you do things like `functools.singledispatchmethod`.


Any language with reflections needs to evaluate types as something meaningful at runtime.


The runtime mirror doesn't have to have the same name as the compile-time type. Look at Java where you have to do weird things with class objects to do reflective access.


list is also a type. Maybe that wasn't true in older versions, but it's true now.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: