Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 21214:0952904dc1e5 stable
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)
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 01 May 2014 12:15:00 -0700 |
parents | b9defeeb62e6 |
children | 717ba2c3c9da |
comparison
equal
deleted
inserted
replaced
21213:004267ce0338 | 21214:0952904dc1e5 |
---|---|
2354 for x in self._subset: | 2354 for x in self._subset: |
2355 if cond(x): | 2355 if cond(x): |
2356 yield x | 2356 yield x |
2357 | 2357 |
2358 def __and__(self, x): | 2358 def __and__(self, x): |
2359 return lazyset(self, lambda r: r in x) | 2359 return lazyset(self, x.__contains__) |
2360 | 2360 |
2361 def __sub__(self, x): | 2361 def __sub__(self, x): |
2362 return lazyset(self, lambda r: r not in x) | 2362 return lazyset(self, lambda r: r not in x) |
2363 | 2363 |
2364 def __add__(self, x): | 2364 def __add__(self, x): |