You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Don't return implicit optional types by get_type_hints #77314
returns {'x': Optional[int]}. I propose to abandon this behaviour. Although there is not yet a definitive decision about this aspect of PEP-484, see python/typing#275, I think at least at runtime we should not do this.
I'm not sure we should change this ahead of a definitive decision. When you use mypy with the option that forbids it, your program will be invalid, and it doesn't really matter what we do at runtime; but that option is not the default yet, and without that option, mypy treats the type as Optional[int].
Activity
ilevkivskyi commentedon Mar 24, 2018
Currently this code
returns {'x': Optional[int]}. I propose to abandon this behaviour. Although there is not yet a definitive decision about this aspect of PEP-484, see python/typing#275, I think at least at runtime we should not do this.
gvanrossum commentedon Mar 25, 2018
I'm not sure we should change this ahead of a definitive decision. When you use mypy with the option that forbids it, your program will be invalid, and it doesn't really matter what we do at runtime; but that option is not the default yet, and without that option, mypy treats the type as Optional[int].
ilevkivskyi commentedon Mar 25, 2018
OK, let us then keep this issue as a remainder that we need to update the runtime behaviour when the static one changes.
AlexWaygood commentedon Apr 14, 2022
This behaviour was fixed in #30304: