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

Some new stuff in 3.9: https://www.python.org/dev/peps/pep-0585/

Basically they alias all of the old builtins like list to typing.List etc. (Or maybe one should say the goal is to un-alias the alternative type system in typing-module and only use the original builtins).

It can be useful when you for example want to create a type alias like UserList = typing.List[User], which was possible even before, the change is that it now affects the old builtin also, so things that were previously syntax errors are now valid type aliases. Usually such alias assignements are more useful once you have more complex generics with nested dicts and stuff.



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

Search: