Re: [PATCH] make hg-to-git compatible with python2.x and 3.x
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 20, 2018, 19:19 UTC
- Message-ID
- <xmqqsh9v31wa.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <xmqqwoz7324d.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> - map(lambda ..., collection) is not liked; use list comprehension.
> ...
> I am not sure about the change from map(lambda ...) to list
> comprehension, though. Not that I have a preference for or against
> (I am not a Python person), but I do not know if this is a change
> necessary to run with Python 3 or if it is merely more preferred to
> use list comprehension.
> ...
>> - prnts = map(lambda x: x[:x.find(':')], prnts)
>> + prnts = [x[:x.find(':')] for x in prnts]Well, I should have dug this myself a bit more [*1*] before hitting [SEND]. This change is required because map() no longer returns a list. So the bullet item in the proposed commit log message in my earlier message should be updated to say that instead--it was unclear to me so I phrased as if it was a mere preference, but it actually is a required change.
[Footnote]
*1* Well, it would have been ideal if the original patch had enough
information from the beginning to make this kind of "digging"
unnecessary ;-)