[PATCH 3 of 4 RFC] revset: added __nonzero__ method to lazyset
David Soria Parra
dsp at experimentalworks.net
Fri Feb 21 15:59:19 UTC 2014
On 02/20/2014 10:36 AM, Lucas Moscovicz wrote:
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -2143,6 +2143,11 @@
> def extend(self, x):
> self.append(x)
>
> + def __nonzero__(self):
> + for r in self:
> + return True
> + return False
> +
isn't this equivalent to
def __nonzero__(self):
return any(self)
which should evaluate lazy and stop after the first element
More information about the Mercurial-devel
mailing list