• + 1 comment

    Another, more Pythonic way:

    def reverse(head):
        curr = new_head = head
        while curr:
            curr.prev, curr.next = curr.next, curr.prev
            new_head = curr
            curr = curr.prev
        return new_head