For Optional[T] or T, infer the type T instead of Optional[T].#1818
For Optional[T] or T, infer the type T instead of Optional[T].#1818gvanrossum wants to merge 3 commits intomasterfrom
Optional[T] or T, infer the type T instead of Optional[T].#1818Conversation
|
Is there an equivalent example for FWIW this is kind of blocking further explorations of |
|
|
||
| [case testOptionalTypeOrTypePlain] | ||
| from typing import Optional | ||
| def f(a: Optional[int]) -> int: |
There was a problem hiding this comment.
Maybe test or with both operands optional?
There was a problem hiding this comment.
Also, could test left operand with a complex union type such as Union[int, str, None].
There was a problem hiding this comment.
80056c6 to
690c4d5
Compare
|
I feel like we shouldn't need this special casing and this should just fall out of the |
|
Looks like that was actually pretty straightforward to do. Let's consider #1828 instead of this? |
|
Closing in favor of #1828. |
|
Cool. Maybe someday I'll understand how this works -- the name (find_isinstance_check()) and the resulting variables (right_map, left_map -- why the transposition?) were all kind of confusing. |
|
Agree it's all pretty confusing. The function might be be better named |
Fixes #1817, fixes #1733.