From patchwork Thu May 1 19:20:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1, of, 2, stable] lazyset: directly use __contains__ instead of a lambda From: Pierre-Yves David X-Patchwork-Id: 4463 Message-Id: To: mercurial-devel@selenic.com Cc: pierre-yves.david@ens-lyon.org Date: Thu, 01 May 2014 12:20:25 -0700 # HG changeset patch # User Pierre-Yves David # Date 1398971700 25200 # Thu May 01 12:15:00 2014 -0700 # Branch stable # Node ID c753a48e8bf3557856fb34e34daa49c7fa61b9c3 # Parent 799c494189a9db994cd6ce7fd924e9825b3fe425 lazyset: directly use __contains__ instead of a lambda We apply the same speedup as in spanset, getting rid of the useless lambda. (No new timing, as this is the very same change) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2354,11 +2354,11 @@ class lazyset(object): for x in self._subset: if cond(x): yield x def __and__(self, x): - return lazyset(self, lambda r: r in x) + return lazyset(self, x.__contains__) def __sub__(self, x): return lazyset(self, lambda r: r not in x) def __add__(self, x):