Python Type Hinting - Method Returns a List of the Current Class
Use a string literal for a forward reference:
@staticmethod
def from_file(fname: str, verbose : bool = False)->List['CareerTransition']:
#Do some stuff
pass
An even nicer way then writing the concrete class as stated by @chepner is to use the literal __class__
. The whole thing would look like this:
@staticmethod
def from_file(fname: str, verbose : bool = False) -> List['__class__']:
# Do some stuff
pass