Thread (1 message) 1 message, 1 author, 2018-02-20

Re: [PATCH] make hg-to-git compatible with python2.x and 3.x

From: Junio C Hamano <hidden>
Date: 2018-02-20 19:19:08

Junio C Hamano [off-list ref] writes:
    - 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.
...
quoted
-    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 ;-)



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help