In the Node class, does get_link_node need to check for None?


#1

Question

When coding the get_link_node() method in this exercise, does the method need to include a check for self.link_node being set to None?

Answer

NO. Having self.link_node set to the value of None is an indication that the Node is not linked to another Node which is a normal case that can occur. For example, if Node is used for a linked list and that list contains only one item, the Node would not have a next object to link to. No special checks are needed in the method for this condition.