Forward Declarations for IDE
In PyCharm function annotations help the IDE determine return types. However, it seems to ignore forward declarations. Given the following class, it will not be able to determine that the parent method returns type "Node".
class Node:
def __init(self, parent: 'Node'=None):
self._parent = parent
def parent(self) -> 'Node':
return self._parent
Is there some other way to do forward declarations for PyCharm, or is it just broken?
John
class Node:
def __init(self, parent: 'Node'=None):
self._parent = parent
def parent(self) -> 'Node':
return self._parent
Is there some other way to do forward declarations for PyCharm, or is it just broken?
John
Please sign in to leave a comment.
See example in screenshot.