Dec 1, 2021
PEP8, however also says
---
For sequences, (strings, lists, tuples), use the fact that empty sequences are false:
Yes:
if not seq:
if seq:
No:
if len(seq):
if not len(seq):
---
Which is truthy, yet seems to me like an idiomatic way, often encountered "in the wild".
For the explanation see corresponding thread at https://stackoverflow.com/questions/53513/how-do-i-check-if-a-list-is-empty#:~:text=it's%20a%20trade-off%20between%20explicitness%20and%20type%20flexibility