Hervé Beraud <[email protected]> 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.