Join GitHub today
Last strict optional fixes #4070
This PR will make mypy completely
x: Optional[int] if x in [1, 2, 3]: reveal_type(x) # now this will be 'int'
I allow this only for built-in containers such as
UPDATE: The feature part now has a separate PR #4072.
if fullname in ('enum.Enum', 'enum.IntEnum'): assert fullname is not None
etc. The PRs can be merged in arbitrary order, however it makes sense to merge #4072 first.
This was referenced
Oct 9, 2017
Thanks, looks good! This migration has been a big undertaking and it's great to see the final strict optional exceptions removed. I left just some minor comments.