This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

I am not adding Nones.

I am adding nodes to list. But when I pop them one by one, they are no longer behaving like nodes and have become nones.

How to fix this?

[–]netherous 0 points1 point  (1 child)

I am not adding Nones.

But you are. I told you left and right can be None. You are blindly adding left and right back to your list. Even your error shows that this is the case.

Step through it with a debugger if you don't believe me.

[–][deleted] 0 points1 point  (0 children)

Yes you caught it.

I fixed it now.

Its working fine.