Trying out type hinting, and I'm having a bit of trouble wrapping my head around something:
class Node(object):
credentials_class = credentials.BaseCredentials
@property
def credentials_instance(self) -> [credentials_class]:
return self.credentials_class(self.credentials_data)
class OtherNode(Node):
credentials_class = credentials.OtherCredentials # subclass of BaseCredentials
How can I make it so that OtherNode().credentials_instance returns the type that is specified in credentials_class, for all subclasses of Node?
The credentials_class attribute is not required, if there is some other way for me to tell the system that "this node's credentials_instance property returns this instance type", that would be fine.