Constructing Types
Syntax for type composition:
- list with items of type T: [T]
- tuple of T1, T2, T3: (T1, T2, T3)
- (this explains why we have both tuples and lists!)
- dict with key/value types T1/T2: {T1: T2}
- union of types T1 and T2: T1 | T2
- function (e.g.): def(T1, T2)->T3
Example:
- {str: (int, int) | (int, int, str) | None}