[PATCH] cleanup: use x in (a, b) instead of x == a or x == b
mg at lazybytes.net
Thu Sep 23 06:09:45 CDT 2010
Masklinn <masklinn at masklinn.net> writes:
> On 2010-09-23, at 13:24 , Martin Geisler wrote:
>> Brodie Rao <brodie at bitheap.org> writes:
>>> # HG changeset patch
>>> # User Brodie Rao <brodie at bitheap.org>
>>> # Date 1285218151 18000
>>> # Node ID a9641ee7e37cf6da972ef07e9c8992316587c51a
>>> # Parent f1e8d6f6e682a74a135ba6509b2de26cc8172046
>>> cleanup: use x in (a, b) instead of x == a or x == b
>> I believe I tested this at some point using timeit and found that the
>> longer form is faster. Did you test is too?
> Unless the potentially containing sequence is cached, it probably
> won't be faster. But in cases where performance on the order of a
> fraction of a nanosecond per call is not a very important matter, I
> think the readability and DRY of the `in` form is preferable to the
> double-eq. YMMV
Yeah, I should not have focussed so much on the raw performance of this.
I was just being silly, I'll push it in a second.
Professional Mercurial support
More information about the Mercurial-devel