The __repr__() method needs to return a string. If it doesn't return a string an exception is throwned. Because this class prints it's internal Tree representation to the stdout and never builds a string, I removed this method. If we are to have this method, then we need an actual string representation, but I don't recommend that.