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

TODO: mypy

  • Complex data structures?
  • My types/classes?
  • Allow None (or not) for a variable.
from typing import Generator

def numbers(n: int) -> Generator[int, None, None]:
    return ( x for x in range(n))

print(list(numbers(10)))
from typing import List

def numbers(n: int) -> List[int]:

    return list(range(n))

print(numbers(10))