[Python-ideas] Changing all() and any() to take multiple arguments
Chris Angelico
rosuav at gmail.com
Mon Aug 26 09:23:34 CEST 2013
On Mon, Aug 26, 2013 at 2:50 PM, Clay Sweetser <clay.sweetser at gmail.com> wrote:
> Meaning either that one must write either this, and use parenthesis to avoid
> some obscure order of operations error:
> def is_enabled(self):
> return (
> (self.connected) and
> (not self.broadcasting) and
> (self.mode is 'client')
> )
I'd be inclined toward this option, especially if some of your
expressions are complex checks - the 'and' will short-circuit, a tuple
won't. It looks perfectly readable, to me. Side point: I'd be cautious
about using 'is' with strings, unless you have some way of
guaranteeing that both sides have been interned.
ChrisA
More information about the Python-ideas
mailing list