From 90f652d6e970aa1140c55ce73a1999ccbc425ebe Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 09:54:08 +0800 Subject: [PATCH 1/2] PRF --- ...on 2 to Python 3- What you need to know.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md index 32a5164480..1a835e0975 100644 --- a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md +++ b/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Switching from Python 2 to Python 3: What you need to know) @@ -10,23 +10,23 @@ 从 Python 2 切换到 Python 3 你所需要了解的 ====== -> Python 2 将在几周内到达生命终点,这篇文章是你迁移到 Python 3 之前应该知道的。 +> Python 2 将在几周内走到生命终点,这篇文章是你迁移到 Python 3 之前应该知道的。 -![A sunrise][1] +![](https://img.linux.net.cn/data/attachment/album/201912/01/095336lbppn8qp1nnnwqqp.jpg) 从 2020 年 1 月 1 日开始,Python 2.7 将不再得到正式支持。在此日期之后,将会发布一个[最终错误修复][2]计划,但是仅此而已。 -Python 2 的生命终端(EOL)对你意味着什么?如果正在运行这 Python 2,则需要迁移。 +Python 2 的生命终点(EOL)对你意味着什么?如果正在运行着 Python 2,你需要迁移。 ### 是谁决定 Python 2 的生命终点? 在 [2012][3] 年,维护 Python 编程语言的团队审查了其选项。有两个越来越不同的代码库,Python 2 和 Python 3。这两者都很流行,但是较新的版本并未得到广泛采用。 -除了 Python 3 中处理数据的底层方式由完全重写的 Unicode 支持的变化造成了断层,这个主要版本的变化还一次性出现了一些非向后兼容的更改。这种断层的决定成文于 [2006 年][4]。为了减轻该断层的影响,Python 2 继续保持维护,并向后移植了一些 Python 3 的功能。为了进一步帮助社区过渡,EOL 日期[从 2015 年延长至 2020 年][5]又延长了五年。 +除了 Python 3 中完全重写的 Unicode 支持改变了处理数据的底层方式造成的断层,这个主要版本的变化还一次性出现了一些非向后兼容的更改。这种断层的决定成文于 [2006 年][4]。为了减轻该断层的影响,Python 2 继续保持了维护,并向后移植了一些 Python 3 的功能。为了进一步帮助社区过渡,EOL 日期[从 2015 年延长至 2020 年][5],又延长了五年。 -维护不同的代码库是该团队知道必须解决的麻烦。最终,他们[宣布了][6]一项决定: +该团队知道,维护不同的代码库是必须解决的麻烦。最终,他们[宣布了][6]一项决定: ->“我们是制作和照料 Python 编程语言的志愿者。我们已决定 2020 年 1 月 1 日将是我们停止使用 Python 2 的日子。这意味着在这一天之后,即使有人发现其中存在安全问题,我们将不再对其进行改进。你应尽快升级到 Python 3。” +>“我们是制作和照料 Python 编程语言的志愿者。我们已决定 2020 年 1 月 1 日将是我们停止使用 Python 2 的日子。这意味着在这一天之后,即使有人发现其中存在安全问题,我们也将不再对其进行改进。你应尽快升级到 Python 3。” [Nick Coghlan][7] 是 CPython 的核心开发人员,也是 Python 指导委员会的现任成员,[在他的博客中添加了更多信息][8]。由 [Barry Warsaw][10](也是 Python 指导委员会的成员)撰写的 [PEP 404][9] 详细说明了 Python 2.8 永远不会面世的原因。 @@ -38,13 +38,13 @@ Python 2 的生命终端(EOL)对你意味着什么?如果正在运行这 P ### 使用 Python 3 的原因 -不管是否有持续的支持,尽快迁移到 Python 3 是一个好主意。Python 3 将继续受到支持,它具有 Python 2 所没有的一些非常整洁的东西。 +不管是否有持续的支持,尽快迁移到 Python 3 是一个好主意。Python 3 将继续受到支持,它具有 Python 2 所没有的一些非常优雅的东西。 -最近发布的 [Python 3.8][17] 包含 [海象运算符][19]、[位置参数][20]和[自描述的格式化字符串][21]等[功能][18]。Python 3 的早期版本引入的[功能][22],例如 [异步 IO][23],[格式化字符串][24],[类型提示][25] 和 [pathlib][26],这里只提及了一点点。 +最近发布的 [Python 3.8][17] 包含 [海象运算符][19]、[位置参数][20]和[自描述的格式化字符串][21]等[功能][18]。Python 3 的早期版本引入的[功能][22],例如 [异步 IO][23]、[格式化字符串][24]、[类型提示][25] 和 [pathlib][26],这里只提及了一点点。 下载最多的前 360 个软件包[已迁移到 Python 3][27]。你可以使用 [caniusepython3][28] 软件包检查你的 `requirements.txt` 文件,以查看你依赖的任何软件包是否尚未迁移。 -### 将Python 2移植到Python 3的参考资源 +### 将 Python 2 移植到 Python 3 的参考资源 有许多参考资源可简化你向 Python 3 的迁移。例如,“[将 Python 2 移植到 Python 3 指南][29]”列出了许多工具和技巧,可帮助你实现与 Python 2/3 单一源代码的兼容性。在 [Python3statement.org][30] 上也有一些有用的技巧。 @@ -52,7 +52,7 @@ Python 2 的生命终端(EOL)对你意味着什么?如果正在运行这 P ### 加入我们! -距 2020 年 1 月 1 日仅有几周了。如果你需要每天提醒一下它即将到来的时间(并你使用 Twitter 的话),请关注 [Python 2 日落倒计时][36] Twitter 机器人。 +距 2020 年 1 月 1 日仅有几周了。如果你需要每天提醒一下它即将到来的时间(并且你使用 Twitter 的话),请关注 [Python 2 日落倒计时][36] Twitter 机器人。 -------------------------------------------------------------------------------- @@ -61,7 +61,7 @@ via: https://opensource.com/article/19/11/end-of-life-python-2 作者:[Katie McLaughlin][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From abf56523c916a6d24491dbfb488fe7f1b9d03f04 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 09:54:47 +0800 Subject: [PATCH 2/2] PUB @wxy https://linux.cn/article-11629-1.html --- ...tching from Python 2 to Python 3- What you need to know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191120 Switching from Python 2 to Python 3- What you need to know.md (99%) diff --git a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/published/20191120 Switching from Python 2 to Python 3- What you need to know.md similarity index 99% rename from translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md rename to published/20191120 Switching from Python 2 to Python 3- What you need to know.md index 1a835e0975..f89984a90c 100644 --- a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md +++ b/published/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11629-1.html) [#]: subject: (Switching from Python 2 to Python 3: What you need to know) [#]: via: (https://opensource.com/article/19/11/end-of-life-python-2) [#]: author: (Katie McLaughlin https://opensource.com/users/glasnt)