From: Junio C Hamano <gitster@pobox.com>
To: "Hervé Beraud" <herveberaud.pro@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Rewrite feature to render hg-to-git compatible with python2.x and 3.x
Date: Tue, 17 Sep 2019 15:35:05 -0700 [thread overview]
Message-ID: <xmqqd0fy7dra.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <0102016d3f74d202-d5b32dd4-0098-4ad0-8ac7-5fde254f7796-000000@eu-west-1.amazonses.com> ("Hervé Beraud"'s message of "Tue, 17 Sep 2019 13:41:23 +0000")
Hervé Beraud <herveberaud.pro@gmail.com> writes:
> Rewrite features that are no longer supported (or recommended)
> in Python 3 in the script so that it can be used with both
> Python 2 and 3, namely:
>
> - print is not a statement; use print() function instead.
> - dict.has_key(key) is no more; use "key in dict" instead.
> - map(lambda ..., collection) is not liked; use list comprehension.
The first two are must haves (iow, without them the code would not
work with Py3), but the last one sounds like a mere preference. Is
there some authoritative source we can quote (e.g. "PEPx says that
we should prefer X over Y")?
> These changes introduce a syntaxe compatible with the both versions of
> python.
>
> Python 2 is EOL at the end of 2019, the major part of distros
> and systems now come with python 3 is the default version so
> these address the situation to render this script compatible with
> the latest versions of python.
The explanation looks vaguely familiar. I would have placed the
background first, and then description of what is done next, perhaps
like:
Python 2 is EOL at the end of 2019, many distros and systems now
come with python 3 as their default version.
Rewrite features that are no longer supported (or recommended)
in Python 3 in the script so that it can be used with both
Python 2 and 3, namely:
- print is not a statement; use print() function instead.
- dict.has_key(key) is no more; use "key in dict" instead.
- map(lambda ..., collection) is not liked; use list comprehension.
to make it even easier to read without unnecessary repetition, but
what you wrote is clear enough already.
The patch text looked clearly done. Nice.
next prev parent reply other threads:[~2019-09-17 22:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 11:18 [PATCH] make hg-to-git compatible with python2.x and 3.x Hervé Beraud
2018-02-15 22:06 ` Junio C Hamano
2018-02-20 16:52 ` Hervé Beraud
2018-02-20 19:14 ` Junio C Hamano
2018-02-20 19:19 ` Junio C Hamano
2019-09-17 13:41 ` [PATCH] Rewrite feature to render " Hervé Beraud
2019-09-17 22:35 ` Junio C Hamano [this message]
2019-09-17 22:40 ` Junio C Hamano
2019-09-18 8:33 ` [PATCH v2] hg-to-git: make it compatible with both python3 and python2 Hervé Beraud
2019-09-18 17:21 ` Junio C Hamano
2019-09-18 17:55 ` [PATCH v3] " Hervé Beraud
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqd0fy7dra.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=herveberaud.pro@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).