git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 ;-)
Previous: Junio C HamanoNext: Hervé Beraud
Message 5 of 11 in “make hg-to-git compatible with python2.x and 3.x”
  1. make hg-to-git compatible with python2.x and 3.xHervé Beraud, Feb 15, 2018
  2. Junio C HamanoFeb 15, 2018
  3. make hg-to-git compatible with python2.x and 3.xHervé Beraud, Feb 20, 2018
  4. Junio C HamanoFeb 20, 2018
  5. Junio C HamanoFeb 20, 2018
  6. Rewrite feature to render hg-to-git compatible with python2.x and 3.xHervé Beraud, Sep 17, 2019
  7. Junio C HamanoSep 17, 2019
  8. Junio C HamanoSep 17, 2019
  9. hg-to-git: make it compatible with both python3 and python2Hervé Beraud, Sep 18, 2019
  10. Junio C HamanoSep 18, 2019
  11. hg-to-git: make it compatible with both python3 and python2Hervé Beraud, Sep 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.