Let's imagine I have a class:
class Node:
def __init__(self, value=None, next_item=None):
self.value: int = value
self.next_item: Node = next_item
Is it possible to "type hint" all __init__
params? Something like this:
class Node:
def __init__(self: Self, value: int = None, next_item: Node = None):
self.value: int = value
self.next_item: Node = next_item
next_item
, as we can see, can't refer to Node
, because it doesn't yet exist. Are there any ways to do it?