tk0miya / docutils-stubs

The Unlicense
9 stars 5 forks source link

Make List[Node] covariants #6

Closed tk0miya closed 5 years ago

cocoatomo commented 6 years ago

Minimum examples are following,

from typing import *

bool_tuple: Tuple[bool, bool, bool] = (True, False, True)
int_tuple: Tuple[int, int, int] = bool_tuple  # OK

bool_iterable: Iterable[bool] = (b for b in [True, False, True])
int_iterable: Iterable[int] = bool_iterable  # OK

bool_list: List[bool] = [True, False, True]
int_list: List[int] = bool_list  # type error
tk0miya commented 6 years ago

Updated!

tk0miya commented 5 years ago

I'll ship this after merging this. But it should be separated this PR itself.