Skip to content

Commit

Permalink
Update linkedlist_deque.py (#1625)
Browse files Browse the repository at this point in the history
According to PEP 8, "Comparisons to singletons like None should always be done with is or is not, never the equality operators."
  • Loading branch information
wodray authored Jan 21, 2025
1 parent 9c78c51 commit 1a8b4f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions codes/python/chapter_stack_and_queue/linkedlist_deque.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def pop(self, is_front: bool) -> int:
val: int = self._front.val # 暂存头节点值
# 删除头节点
fnext: ListNode | None = self._front.next
if fnext != None:
if fnext is not None:
fnext.prev = None
self._front.next = None
self._front = fnext # 更新头节点
Expand All @@ -78,7 +78,7 @@ def pop(self, is_front: bool) -> int:
val: int = self._rear.val # 暂存尾节点值
# 删除尾节点
rprev: ListNode | None = self._rear.prev
if rprev != None:
if rprev is not None:
rprev.next = None
self._rear.prev = None
self._rear = rprev # 更新尾节点
Expand Down

0 comments on commit 1a8b4f6

Please sign in to comment.