Bug report
Bug description:
class MyClass:
class MyTreeSubClass:
def __init___():
self.children = []
def addchild(foo):
self.children.append(foo)
def postorder_traversal():
for child in children:
yield from child.postorder_traversal()
yield self
def bar():
baz = self.MyTreeSubClass()
#init baz logic here
for node in baz.postorder_traversal():
node: self.MyTreeSubClass #Variable not allwed in type expression
node.what_even_am_i()
I can't do a self.SubClass type hint because self is not allowed in type hinting.
this line is the issue:
node: self.MyTreeSubClass
#Variable not allwed in type expression
CPython versions tested on:
3.12
Operating systems tested on:
Windows