Clever, but I don't think this is really best practices.
This comment is hidden because it contains spoiler information about the solution
thanks for your explaination. I got stuck at that
It would probably be better defining the condition like "if node is not None" instead of just "if node." See PEP 0008.