What's the most elegant way of doing something like this:
>>> tests = [false, false, false]
>>> map_or(test)
false
>>> tests = [true, false, false]
>>> map_or(test)
true
The map_or function should return true if one or more of list elements are true.
Use any(). It is a built-in function that just does what you want.
any(tests)
Built in function :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With