[issue33133] Don't return implicit optional types by get_type_hints

Ivan Levkivskyi report at bugs.python.org
Sat Mar 24 14:16:02 EDT 2018


New submission from Ivan Levkivskyi <levkivskyi at gmail.com>:

Currently this code

def f(x: int = None):
    pass

get_type_hints(f)

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 https://github.com/python/typing/issues/275, I think at least at runtime we should not do this.

----------
components: Library (Lib)
messages: 314378
nosy: gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: Don't return implicit optional types by get_type_hints
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33133>
_______________________________________


More information about the Python-bugs-list mailing list