+ 2
lst != [] How this expression can be simplified?
PyCharm displays the warning.
3 Respostas
+ 4
The problem is not in this expression, it should work.
But you can just write:
if lst:
...
Because every list that's not empty is evaluated as True.
+ 2
HonFu, thanks!
+ 1
It is already a simplified expression. It will be evaluated as true if the list is not empy.