class Test: def test(self, child : Test): pass NameError: name 'Test' is not defined
I understand that the class "Test" is not defined until the class definition is executed. But it is very very common to build recursive data structures, and I have concrete use case where the IDE did not recognize the type of the argument, and as a result it forgot to rename some method calls when I auto-refactored the name of the method. I'm not an expert, but I believe that these annotations are not used by the byte compiler for anything. This is just pure syntax introduced for the person who reads the code. Is there a known obsticle that would prevent us from detecting recursive type annotations? (E.g. bind the annotation to the class that is being defined.) Thanks, Laszlo -- https://mail.python.org/mailman/listinfo/python-list