Answers for "typing multiple types"

0

typing multiple types

from typing import Union


def foo(client_id: str) -> Union[list,bool]
Posted by: Guest on March-30-2020
7

python type hint list

# For collections, the name of the type is capitalized, and the
# name of the type inside the collection is in brackets
x: List[int] = [1]
x: Set[int] = {6, 7}
  
# For simple built-in types, just use the name of the type
x: int = 1
x: float = 1.0
x: bool = True
x: str = "test"
x: bytes = b"test"
Posted by: Guest on February-16-2020

Code answers related to "typing multiple types"

Python Answers by Framework

Browse Popular Code Answers by Language