Thread (1 message) 1 message, 1 author, 2019-09-17

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

From: Junio C Hamano <hidden>
Date: 2019-09-17 22:35:14

Hervé Beraud [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help