I decided that static typing would really make my life easier in Python, considering I normally work in C. I made a class like so:
class node(object):
"""
properties, constructor, etc.
"""
def add_outneighbor(self, neighbor: node) -> None:
"""
do stuff
"""
Flake8 tells me that node
is an unknown type in add_outneighbor
's definition. Currently I'm working around the issue with isinstance(arg, type)
, but that seems to defeat the purpose of having the type hints. Is there a better way to do this?
This is the resource I referred to in order to get the information on type hints, but I couldn't find any discussion about this self-referential issue.