basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

handle stringified types consistently

Open KotlinIsland opened this issue 2 years ago • 0 comments

# python3.8
a: "list[int]"  # error: "list" is not subscriptable, use "typing.List" instead
cast("list[int]", [])  # valid
cast(List["list[int]"], [])  # error

cast has inconsistent behaviour because I think it makes sense to allow it like that, so why not all stringified types?

maybe because of introspection reasons? which don't apply to cast.

KotlinIsland avatar Nov 01 '23 01:11 KotlinIsland