This shows you the differences between two versions of the page.
|
ic:resurse:python [2023/10/02 00:09] razvan.smadu [Python3 Crash Course] |
ic:resurse:python [2023/10/02 00:10] (current) razvan.smadu [Python3 Crash Course] |
||
|---|---|---|---|
| Line 264: | Line 264: | ||
| Exemple: | Exemple: | ||
| <code python> | <code python> | ||
| - | from typing import List, Sequence, Tuple, TypeVar | + | from typing import Dict, List, Sequence, Tuple, TypeVar |
| my_string: str = "hello world" # A variable storing a string | my_string: str = "hello world" # A variable storing a string | ||
| Line 281: | Line 281: | ||
| def first(l: Sequence[T]) -> T: # A generic function | def first(l: Sequence[T]) -> T: # A generic function | ||
| return l[0] | return l[0] | ||
| + | |||
| + | # Type alias | ||
| + | MyCustomType = Dict[str, List[Tuple[int, int]]] | ||
| </code> | </code> | ||