I have the following list:
In [572]: l2
Out[572]: [(), (), ()]
I need to check if all tuples within the list are empty.
My attempt:
In [581]: x = [True if i else False for i in l2]
In [584]: x
Out[584]: [False, False, False]
In [583]: not any(x)
Out[583]: True
I used a list comprehension to create a list with boolean values (True) if tuple is not empty, (False) if tuple is empty.
Then I'm using any to check if all elements is my list all False.
Is there a more concise way of doing all this?
 
     
    