How do you alias a type in Python?

Since Python 3.5 you may use typing module.

Quoting docs,
A type alias is defined by assigning the type to the alias:

Vector = List[float]

To learn more about enforcing types in Python you may want to get familiar with PEPs: PEP483 and PEP484.

Python historically was using duck-typing instead of strong typing and hadn’t built-in way of declaring types before 3.5 release.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)