You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it is a good idea to change the code to this:
def add_child(self, child):
"""
Sets the parameter as the child of the node
:return: the child node
"""
if self.child is not None:
raise ValueError("Child is being overwritten")
self.child = child
return self.child
Or similar, to prevent repeated add_child being called when 'self.child' is already set, thus losing the previous one
The text was updated successfully, but these errors were encountered:
why?
it wouldn't protect against setting the child directly, and in some complex decision graphs, it may be easier to first create a simple structure and then modify it in place...
I think it is a good idea to change the code to this:
Or similar, to prevent repeated add_child being called when 'self.child' is already set, thus losing the previous one
The text was updated successfully, but these errors were encountered: