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

2018-03-25 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

OK, let us then keep this issue as a remainder that we need to update the 
runtime behaviour when the static one changes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-03-24 Thread Guido van Rossum

Guido van Rossum  added the comment:

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].

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2018-03-24 Thread Ivan Levkivskyi

New submission from Ivan Levkivskyi :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com