Pattern: Missing use of not in
for membership test
Issue: -
Tests for membership should use the form x not in the_list
rather than not x in the_list
. The former example is more readable.
my_list = [1, 2, 3]
if not num in my_list:
print(num)
my_list = [1, 2, 3]
if num not in my_list:
print(num)