The main problem with checking if a list is not empty is that it can be slow.
if not None or not '': print('Not empty!')
The first condition is if “not None”, which evaluates to True. The second condition is “or not ””, which also evaluates to True. Therefore, the entire expression evaluates to True and the print statement is executed.
Not none
In Python, “not none” is a boolean expression that evaluates to True if there is at least one item in a list, and False otherwise.
How to : empty in python
def empty(self):
for i in range(len(self)):
self[i] = ”