Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
class Spam: bar: typing.Optional[bar] = str class Spaz: bar: typing.Optional[bar] = None print(Spam.__annotations__) print(Spaz.__annotations__) {'bar': typing.Union[str, NoneType]} {'bar': <class 'NoneType'>} In Spam bar has str assigned to it and seems like in Spaz bar is assigned None and hence during annotation creation this evaluates to bar: typing.Optional[None] where None is the value of bar and in Spam.bar it's typing.Union[str, NoneType] instead. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36363> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com