Hi, I have a for loop that looks like this:
if any(contact.new_messages for contact in contacts.values()):
Now I want to only apply this any on certain contacts, not all of them.
Contacts have a field visible and only those accounts with visible = True should be taken into account.
I know I can do something like:
if any(contact.new_messages for contact in filter(external_function, contacts.values())):
with
def external_function(c):
return c.visible
but can i do this inline?
Like:
if any(contact.new_messages for contact in filter(c -> c.visible, contacts.values())):