New submission from 洪明聖 <hung11112...@gmail.com>: The class methods have a problem compiling when the type refers to the union of itself and others.
# tmp.py class Foo: def __init__(self, tmp: "Foo"|int): pass # Error Traceback (most recent call last): File "/Project/Mslc/Grammar/tmp.py", line 1, in <module> class Foo: File "/Project/Mslc/Grammar/tmp.py", line 2, in Foo def __init__(self, tmp: "Foo"|int): TypeError: unsupported operand type(s) for |: 'str' and 'type' ---------- messages: 406720 nosy: TNThung priority: normal severity: normal status: open title: Type hint for methods type: compile error versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45857> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com