Skip to content

Commit 4961b7c

Browse files
committed
"!= None" to "is not None"
1 parent 1562b40 commit 4961b7c

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

data_structures/linked_list/deque_doubly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, link_p, element, link_n):
2121

2222
def has_next_and_prev(self):
2323
return " Prev -> {0}, Next -> {1}".format(
24-
self._prev != None, self._next != None
24+
self._prev is not None, self._next is not None
2525
)
2626

2727
def __init__(self):

data_structures/linked_list/doubly_linked_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def isEmpty(self): # Will return True if the list is empty
6262

6363
def display(self): # Prints contents of the list
6464
current = self.head
65-
while current != None:
65+
while current is not None:
6666
current.displayLink()
6767
current = current.next
6868
print()

dynamic_programming/fibonacci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get(self, sequence_no=None):
2828
[0, 1, 1, 2, 3, 5]
2929
[]
3030
"""
31-
if sequence_no != None:
31+
if sequence_no is not None:
3232
if sequence_no < len(self.fib_array):
3333
return print(self.fib_array[: sequence_no + 1])
3434
else:

hashes/hamming_code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def emitterConverter(sizePar, data):
121121
# counter to control the loop reading
122122
contLoop = 0
123123
for x in dataOrd:
124-
if x != None:
124+
if x is not None:
125125
try:
126126
aux = (binPos[contLoop])[-1 * (bp)]
127127
except IndexError:
@@ -224,7 +224,7 @@ def receptorConverter(sizePar, data):
224224
# Counter to control loop reading
225225
contLoop = 0
226226
for x in dataOrd:
227-
if x != None:
227+
if x is not None:
228228
try:
229229
aux = (binPos[contLoop])[-1 * (bp)]
230230
except IndexError:

project_euler/problem_551/sol1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def next_term(a_i, k, i, n):
5252

5353
sub_memo = memo.get(ds_b)
5454

55-
if sub_memo != None:
55+
if sub_memo is not None:
5656
jumps = sub_memo.get(c)
5757

58-
if jumps != None and len(jumps) > 0:
58+
if jumps is not None and len(jumps) > 0:
5959
# find and make the largest jump without going over
6060
max_jump = -1
6161
for _k in range(len(jumps) - 1, -1, -1):

sorts/odd_even_transposition_parallel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def oeProcess(position, value, LSend, RSend, LRcv, RRcv, resultPipe):
3535
# find out we are sorted as it does to sort the list with this algorithm
3636
for i in range(0, 10):
3737

38-
if (i + position) % 2 == 0 and RSend != None:
38+
if (i + position) % 2 == 0 and RSend is not None:
3939
# send your value to your right neighbor
4040
processLock.acquire()
4141
RSend[1].send(value)
@@ -48,7 +48,7 @@ def oeProcess(position, value, LSend, RSend, LRcv, RRcv, resultPipe):
4848

4949
# take the lower value since you are on the left
5050
value = min(value, temp)
51-
elif (i + position) % 2 != 0 and LSend != None:
51+
elif (i + position) % 2 != 0 and LSend is not None:
5252
# send your value to your left neighbor
5353
processLock.acquire()
5454
LSend[1].send(value)

0 commit comments

Comments
 (0)