Why does 'return self' return None?

前端 未结 4 1945
我寻月下人不归
我寻月下人不归 2021-01-25 06:49

I\'m trying to get the top node of a chain in getTopParent(). When I print out self.name, it indeed prints out the name of the parent instance; however

4条回答
  •  自闭症患者
    2021-01-25 07:28

    Returning self worked just fine in the True side of the if. However, the recursive call in the else side does not return anything. Use return self.owner.getTopParent() instead.

提交回复
热议问题