London | 25-SDC-NOV | Jesus del Moral | Sprint 2 | Implement Linked List#136
London | 25-SDC-NOV | Jesus del Moral | Sprint 2 | Implement Linked List#136delmorallopez wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
e6ca811 to
58edea4
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
58edea4 to
22e3f54
Compare
cjyuan
left a comment
There was a problem hiding this comment.
The PR description is not quite accurate.
|
|
||
| if old_tail.previous: | ||
| self.tail = old_tail.previous | ||
| self.tail.next = None | ||
| else: | ||
| # Only one element | ||
| self.head = None | ||
| self.tail = None | ||
|
|
There was a problem hiding this comment.
-
Why not also clean up references in this method?
-
Could consider delegating the node removing task to
remove()-- less code to maintain.
There was a problem hiding this comment.
Delegating to remove() would definitely reduce duplication and keep the logic in one place. It would make the implementation cleaner and easier to maintain, since any changes to the removal logic would only need to be made in a single method.
Delegating to remove(old_tail) does include the cleanup references because remove() method already does this
|
All good! Well done. |
|
Closing PR because the SDC run has finished. Feel free to re-open if you're still working on it. |
Implement a linked list in Python