James Briggs
1 min readJun 14, 2020

--

Thanks Sankalp, yes they introduced in 3.5 with PEP 484 (I think this was the earliest — I could be wrong). What 3.9 introduces is improved type hinting, eg rather than:

import typingvals: typing.Tuple[int, int] = (3, 4)

We can remove the import part and also replace Tuple with tuple:

vals: tuple[int, int] = (3, 4)

Small changes, but syntax-wise I think is great.

--

--

James Briggs
James Briggs

Written by James Briggs

Freelance ML engineer learning and writing about everything. I post a lot on YT https://www.youtube.com/c/jamesbriggs

No responses yet