vatbub, In the future, when people ask me why I dislike #Python, I will redirect them to this #StackOverflow question: https://stackoverflow.com/questions/53513/how-do-i-check-if-a-list-is-empty
A seemingly simple task: Check if a list is empty or not.
Solution 1:
if not a:
print("List is empty")Pros:
- Very concise
- According to the comments "idiomatic"
- Apparently always O(1)
Cons:
- How the hell can a list suddenly be boolean!?!?!?
Add comment