Update linkedlist_deque.py (#1625)

According to PEP 8, "Comparisons to singletons like None should always be done with is or is not, never the equality operators."
This commit is contained in:
Rui 2025-01-21 18:46:41 +08:00 committed by GitHub
parent 9c78c513c2
commit 1a8b4f6364
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,7 +69,7 @@ class LinkedListDeque:
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 # 更新头节点
@ -78,7 +78,7 @@ class LinkedListDeque:
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 # 更新尾节点