[PATCH 1 of 9] changegroup: use `iter(callable, sentinel)` instead of while True

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Aug 7 10:07:05 EDT 2016



On 08/06/2016 08:10 PM, Gregory Szorc wrote:
> On Sat, Aug 6, 2016 at 8:02 AM, Augie Fackler <raf at durin42.com
> <mailto:raf at durin42.com>> wrote:
>
>     # HG changeset patch
>     # User Augie Fackler <augie at google.com <mailto:augie at google.com>>
>     # Date 1470419998 14400
>     #      Fri Aug 05 13:59:58 2016 -0400
>     # Node ID 84bc06986855488a7237adc057655baa1e3c3e09
>     # Parent  91b2f21763955063b994b07a1060305e0fe93031
>     changegroup: use `iter(callable, sentinel)` instead of while True
>
>
> TIL iter(callable, sentinel) is a thing. That's really cool!
>
> This series is a nice cleanup and LGTM. My only concern would be
> performance. But it looks like checking of the sentinel is always done
> in the C layer in calliter_iternext(). And we were already effectively
> doing the same thing in Python. So if nothing else this should be a
> little faster due to avoiding extra Python interpreter instructions.

Nice code improvement all over the place.
Pushed, thanks for the review.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list