3 ms·
It bugged me too. Here's the equivalent logic without even using all (which is definitely the right approach): for rule in self.rules: if not rule
by evmar 11y ago
It bugged me too. Here's the equivalent logic without even using all (which is definitely the right approach):
for rule in self.rules:
if not rule.canPost:
return False
return True
That's the same number of lines of code, doesn't require two imports, and is way easier to follow. I love functional programming but Python (intentionally, see reduce in py3) is not a language for doing it.
- jacobolus 11y agoreturn all(rule.canPost for rule in self.rules)