any():
if any(t < 0 for t in x):
# do something
Also, if you’re going to use “True in …”, make it a generator expression so it doesn’t take O(n) memory:
if True in (t < 0 for t in x):
any():
if any(t < 0 for t in x):
# do something
Also, if you’re going to use “True in …”, make it a generator expression so it doesn’t take O(n) memory:
if True in (t < 0 for t in x):