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.

Written by

Data scientist learning and writing about everything.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store