[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- status: open -> closed ___ Python tracker ___ ___

[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- resolution: -> not a bug stage: -> resolved ___ Python tracker ___

[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Guido van Rossum
Guido van Rossum added the comment: This bug report can be closed. -- ___ Python tracker ___

[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: This is actually an intended behaviour. Moreover, the implicit optionality of arguments that default to `None` is deprecated and will be removed in one of the future versions. (Note that since typing module is still provisional, this

[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Ned Deily
Change by Ned Deily : -- nosy: +gvanrossum, levkivskyi ___ Python tracker ___ ___

[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Vlad Shcherbina
Vlad Shcherbina added the comment: If the maintainers agree that it's desirable to automatically deduce optionality, I'll implement it. -- ___ Python tracker

[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Vlad Shcherbina
New submission from Vlad Shcherbina : from typing import * def f(arg: str = None): pass print(get_type_hints(f)) # {'arg': typing.Union[str, NoneType]} # as expected class T(NamedTuple): field: str = None print(get_type_hints(T)) # {'field': } # but it