Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Define complex type alias

ReturnType = dict[str, int]
result: ReturnType = {
        "blue": 1,
        "green": 0,
}
#result: ReturnType = {
#        "blue": "ok",
#        "green": 0,
#}

# ------------------------------------------

UnionReturnType = dict[str, str | int]
ret: UnionReturnType = {
        "blue": "ok",
        "green": 0,
}