Doubly linked

This works in this case because user-defined classes always evaluate to "True", unless you rig them otherwise.  What you're really checking here, though, is that your head exists - ie, that it "is not None."  That would be a more specific and, in other applications, less error-prone way to check the status of your head node.