Is try-catch the only method to do that?
If d is your deque, use
d
if d: # not empty else: # empty
This will implicitly convert d to a bool, which yields True if the deque contains any items and False if it is empty.
bool
True
False
1.4m articles
1.4m replys
5 comments
57.0k users