Martijn Pieters added the comment: A temporary work-around is to use a function to raise a NameError exception when the module attribute doesn't exist yet:
def _forward_A_reference(): try: return a.A except AttributeError: # not yet.. raise NameError('A') class B: def spam(self: 'B', eggs: typing.Union['_forward_A_reference()', None]): pass ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26477> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com