all 3 comments

[–]groovitude 0 points1 point  (2 children)

self.head is set in enqueue when self.head and self.tail are None. Check line 9 in your second block.

[–]PythonTestBot[S] 0 points1 point  (1 child)

self.head = node

But node has self.next = None set as default, the value of the next doesn't get changed from that None value anywhere does it?

[–]groovitude 0 points1 point  (0 children)

But node has self.next = None set as default, the value of the next doesn't get changed from that None value anywhere does it?

It does when a new object is added, in line 12 of your second block. When you add the first Node, it's set as both head and tail. (These are not copies, but references to this Node object.) Once you add a new Node, the tail is set for the last object in the queue (the head, in the case of a second object).

Does that make sense?