I came across the question Python: What is the best way to check if a list is empty? on SO.
Now if I wanted to return a True
(False
) depending on whether a collection coll
is non-empty (empty) from a function, what's the recommended way of doing this ? return not not coll
?
You could use
return bool(coll)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With