I trying to test pylint with default settings and (see python code below) get a warning:
>pylint pylint_test_01.py
>pylint_test_01.py:24:7: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
How can I get rid of this pylint warning without breaking this algorithm and without disable pylint checks (i.e. with default settings)? General principle of enumerating functions from list should remain.
'''Test pylint with default settings warnings'''
from random import randint
def sortaray_builtin(arr):
'''This is built in Python sort function'''
return sorted(arr.copy())
def sortaray_bubble(arr):
'''Bubble sorting algorithm -- is a simplest of sorting algorithms. Perfomance: O(N**2)'''
brr = arr.copy()
for i, _ in enumerate(brr[:-1]):
for j in range(i, len(brr)):
if brr[i] > brr[j]:
brr[i], brr[j] = brr[j], brr[i]
return brr
SFUNCTIONS = [
sortaray_builtin,
sortaray_bubble
]
ARSIZE = 20
ARRY = [randint(0, ARSIZE) for i in range(ARSIZE)]
for SrtFunc in SFUNCTIONS:
# Line below cause an W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)
if SrtFunc == sortaray_builtin:
print("Builtin: ", end='', flush=True)
else:
print("Bubble : ", end='', flush=True)
print(SrtFunc(ARRY))