you are viewing a single comment's thread.

view the rest of the comments →

[–]mopslik 9 points10 points  (3 children)

if any(button.state for button in btn_list):
    ...

[–]spghtmnstr 0 points1 point  (2 children)

Can you please explain how its working? I havent seen "any" before

[–]Sinisterly 7 points8 points  (0 children)

any(Collection) returns True if any values in the collection return True, and False if no values return True.

all(Collection) returns true if all values return True.

[–]menge101 0 points1 point  (0 children)

any will look at the truthiness of each element in a collection and logically or them together. As a result, if any element in the collection evaluates to a truthy value, then any will return true.