
Le ven. 24 janv. 2020 à 08:37, Miro Hrončok <mhroncok@redhat.com> a écrit :
No, the motivation to pospone the changes to 3.10 are projects that alrady support both 2 and 3 at the same time, with or without compatibility libraries like six. Before they had anough time to make the necessary actions to abandon Python 2.7, we ask them to support 3.9 from the same code base.
Let me give you an example. The python-ipmi project works on Python 2.7-3.8, but it is not longer compatible with Python 3.9 because tostring/fromstring methods have been removed from array.array. IMO this change is a good example to illustrate the issue: https://github.com/kontron/python-ipmi/pull/73/files I chose to add py3_array_tobytes() and py3_array_frombytes() functions rather than adding "if _PY3: ... else: ...". Example: - self.minor = int(data[1:2].tostring().decode('bcd+')) + self.minor = int(py3_array_tobytes(data[1:2]).decode('bcd+')) This change reminds me when I added "Python 3" support to dozens of Python projects. You can see in this PR that Python 3.9 currently requires to modify 9 files in a small project. It is likely to be worse in a larger project. With Python 3.9, we cannot simply group all Python 3.x versions under "Python 3" anymore. Currently, a code compatible with "Python 3" means more likely compatible with "Python 3.5-3.8" ("Python 3.3-3.8" for the most conservative projects?). We kept a compatibility layer with Python 2 on purpose, PEP 4 says: "In order to facilitate writing code that works in both Python 2 & 3 simultaneously, any module that exists in both Python 3.5 and Python 2.7 will not be removed from the standard library until Python 2.7 is no longer supported as specified by PEP 373." The rule was used since Python 3.0 until Python 3.8, but it changed in Python 3.9 which includes many incompatible changes for the first time in the Python 3 major version. Victor
from collections import Sequence
With either:
try: from collections.abc import Sequence except ImprotError: # Python 2.7 doesn't have collections.abc from collections import Sequence
Or:
from compatlib.moves.collections_abc import Sequence
In both cases, we move the burden of having a compatibility layer of some sort from one central location (Python 3.9 stdlib) to dozens (hundreds?) locations.
For those who have been on 3 for a while, updating to use the newer APIs for 3.9 vs 3.10 shouldn't make a difference.
For Python 3 only projects? No, no difference.
Like-wise for those with 2/3 straddling code bases (we'll just need to add a few more things to our shims).
And our point is that because it's too early in 2020 to drop Python 2 code, it is better to encourage projects to update the code as Python 3 only in a year than to let them add more shims now just to hopefully remove them in couple months.
Anyone who hasn't supported/used Python 3 until now shouldn't have a problem with sticking with 3.8 until they are ready to make more adjustments, and those who have had to keep Python 2 around to run those applications/frameworks/whatevers will, I should think, be thrilled to use any Python 3 instead. :-)
This does not affect projects who don't support Python 3 yet.
-- Miro Hrončok -- Phone: +420777974800 IRC: mhroncok _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/TFCAMIAJ... Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.