为什么不切换到Python 3.x?

时间:2021-07-26 18:16:15

I ask this for deployable reasons. As in, if I write a solution in python, I feel bound to write to 2.x due to the lack of adoption of python 3. This is a major daily concern of mine, and I want to figure out what's going on.

我问这是出于可部署的原因。就像在,如果我在python中编写一个解决方案,由于缺乏对python 3的采用,我觉得必然会写入2.x。这是我日常关注的一个问题,我想知道发生了什么。

For many of the python-based questions here, people are giving solutions that simply do not work in python 3.x.

对于许多基于python的问题,人们提供的解决方案根本不适用于python 3.x.

So, I ask the question: What has prevented you from switching to python 3.x in your personal or work environment? The conversion script exists, and yet programmers (who are usually the earliest adopters of everything) seem to refuse to upgrade.

所以,我问一个问题:什么阻止你在个人或工作环境中切换到python 3.x?转换脚本存在,但程序员(通常是最早的采用者)似乎拒绝升级。

Why?

12 个解决方案

#1


[Edit 03/10/2014: This answer is now out-of-date. Django has supported Python 3 for some time.]

[编辑03/10/2014:这个答案现在已经过时了。 Django已经支持Python 3了一段时间。]

[However, it must also be noted that the django third-party packages and extensions used in many Django projects are in various stages of Python 3 compatibility implementation. More details can be found in Django packages website which tracks the statuses of various projects.]

[但是,还必须注意的是,许多Django项目中使用的django第三方包和扩展都处于Python 3兼容性实现的不同阶段。更多细节可以在Django软件包网站上找到,它跟踪各种项目的状态。]

Django has not moved over to 3.0. That is all I need to know.

Django还没有移到3.0。这就是我需要知道的全部内容。

Related Questions

Most of the answers in these questions echo the same sentiments. Aside from Django, too many frameworks/libraries - WxPython, PyGame, Django, etc - have still not adopted it. I'm sure as hell not making the move until they do.

这些问题中的大部分答案都表达了同样的观点。除了Django之外,太多的框架/库--WxPython,PyGame,Django等 - 仍然没有采用它。我肯定在他们做之前不会采取行动。

#2


Because major libraries that my codebase depends upon have not released a 3.x version. (wxPython, matplotlib, numpy, etc.)

因为我的代码库所依赖的主要库尚未发布3.x版本。 (wxPython,matplotlib,numpy等)

So the responsibility goes upstream from my point of view.

所以责任从我的角度出发上行。

If all my dependencies were 3.x compatible, I'd probably have switched by now.

如果我的所有依赖项都是3.x兼容的,我现在可能已经切换了。

#3


  1. Compiled 3rd party modules haven't updated.
  2. 编译的第三方模块尚未更新。

  3. Different syntax
  4. Slower integers.
  5. The #python IRC channel on freenode has in its title that its too early to switch.
  6. freenode上的#python IRC频道在其标题中说它太早转换。

#4


3rd party tools and libraries. I'm having trouble making some things work under 2.6 (not a LOT of trouble, mind you, but some.)

第三方工具和库。我无法让一些东西在2.6以下工作(不是很麻烦,请注意,但有些。)

As I see it, the ecosystem is one of Python's biggest strengths, and going to 3.0 at this point chucks a lot of that out the window. (In a year, I'm sure the story will be totally different.)

正如我所看到的那样,生态系统是Python最大的优势之一,此时达到3.0只能消除掉窗外的大部分内容。 (在一年中,我确信这个故事会完全不同。)

(Obviously, there's a chicken and egg problem here, but fortunately it's not my problem to solve, so I'll stay with 2.6 for a while.)

(显然,这里有一个鸡和鸡蛋的问题,但幸运的是,这不是我的问题,所以我会在2.6下呆一会儿。)

#5


For many of the python-based questions here, people are giving solutions that simply do not work in python 3.x.

对于许多基于python的问题,人们提供的解决方案根本不适用于python 3.x.

I think you answered your own question here. The lack of backwards compatibility makes 3.0 a much harder sell than a seamless upgrade because you have to adjust your thinking and discard some programming techniques to use the new version.

我想你在这里回答了你自己的问题。缺乏向后兼容性使3.0比无缝升级更难卖,因为你必须调整你的想法并放弃一些编程技术来使用新版本。

Call me back when they have an upgrade script for my brain.

当他们有我的大脑升级脚本时给我回电话。

#6


Because the default installation of 2.5 on Mac OSX Leopard works just fine. I have no need to upgrade and I see no advantage to upgrading except an end to the woes of unicode.

因为Mac OSX Leopard上的默认安装2.5工作得很好。我没有必要升级,除了结束unicode的困境之外,我认为升级没有任何优势。

#7


If you are interested to move to Py3k one interesting way would be to write code in Py3k and use a 3to2 script which is being written now as a part of Google Summer of code project, on the lines of 2to3 script.

如果您有兴趣转移到Py3k,一个有趣的方法是在Py3k中编写代码并使用3to2脚本,该脚本现在作为Google Summer of code项目的一部分编写,基于2to3脚本。

#8


The operating system I use the most, Debian, does not have a Python 3 package, not even in the "unstable" (brand new) branch. Unless I compile it myself (which is quite 20th century), it means no Python3 to me.

我使用最多的操作系统Debian没有Python 3软件包,甚至在“不稳定”(全新)分支中也没有。除非我自己编译(这是20世纪),否则对我来说意味着没有Python3。

I bet it is the same issue with many operating systems.

我敢打赌,许多操作系统都存在同样的问题。

#9


Unfortunately, for the same reason as most others have said - 3rd party libraries still not having been made 3.0 compatible. For this reason, as well as that some GNU/Linux distributions (Ubuntu in my case) still comes with Python 2.6, I can't completely throw 2.x out the window yet.

不幸的是,出于与其他大多数人所说的相同的原因 - 第三方库仍然没有与3.0兼容。出于这个原因,除了一些GNU / Linux发行版(在我的情况下是Ubuntu)仍然附带Python 2.6,我还不能完全抛出2.x窗口。

However, the change to 3.0 is not a major one IMO. Except for "print" being a function and the new string formatting system, it's really more or less the same as before.

但是,改为3.0并不是IMO的主要内容。除了作为函数的“print”和新的字符串格式化系统之外,它实际上或多或少与以前相同。

In fact, I find that most of my old scripts (those that do not depend on 3.0 incompatible 3rd party libraries) will work flawlessly in 3.0 after I update all the prints and string formatting. In some cases I've also had to change some module names (specifically stuff from the "email" module), but other than that nothing major.

实际上,我发现在更新所有打印和字符串格式后,我的大多数旧脚本(那些不依赖于3.0不兼容的第三方库)将在3.0中完美运行。在某些情况下,我还必须更改一些模块名称(特别是“电子邮件”模块中的内容),但除此之外没什么大不了的。

Also, all the scripts I have updated for 3.x compatibility so far still seem to work flawlessly in 2.6 (but not older 2.x of course, as they lack the new 3.x syntax).

此外,到目前为止我为3.x兼容性更新的所有脚本似乎仍然在2.6中完美运行(但当然不是较旧的2.x,因为它们缺少新的3.x语法)。

#10


The main reason I am not switching is that so many books and coding challenge websites are still 2.x. I installed 3.x and realized very quickly that I had to uninstall and go to 2.x.

我没有转换的主要原因是,许多书籍和编码挑战网站仍然是2.x.我安装了3.x并很快意识到我必须卸载并转到2.x.

#11


Because of the lack of backward compatibility, switching is hard, especially if there is C code involved. And although I understand the unicode/string thing may be very useful to some people, I certainly don't care about it myself.

由于缺乏向后兼容性,切换很难,特别是如果涉及C代码。虽然我理解unicode / string对某些人来说可能非常有用,但我自己并不关心它。

Basically, Py3k did not solve many problem that I care about (distribution issues, versioning of modules, simplified import model).

基本上,Py3k没有解决我关心的许多问题(分发问题,模块版本化,简化导入模型)。

#12


Python 3+ does not support numpy. Correction: it now does. As it now supports mathplotlib.

Python 3+不支持numpy。更正:现在确实如此。因为它现在支持mathplotlib。

#1


[Edit 03/10/2014: This answer is now out-of-date. Django has supported Python 3 for some time.]

[编辑03/10/2014:这个答案现在已经过时了。 Django已经支持Python 3了一段时间。]

[However, it must also be noted that the django third-party packages and extensions used in many Django projects are in various stages of Python 3 compatibility implementation. More details can be found in Django packages website which tracks the statuses of various projects.]

[但是,还必须注意的是,许多Django项目中使用的django第三方包和扩展都处于Python 3兼容性实现的不同阶段。更多细节可以在Django软件包网站上找到,它跟踪各种项目的状态。]

Django has not moved over to 3.0. That is all I need to know.

Django还没有移到3.0。这就是我需要知道的全部内容。

Related Questions

Most of the answers in these questions echo the same sentiments. Aside from Django, too many frameworks/libraries - WxPython, PyGame, Django, etc - have still not adopted it. I'm sure as hell not making the move until they do.

这些问题中的大部分答案都表达了同样的观点。除了Django之外,太多的框架/库--WxPython,PyGame,Django等 - 仍然没有采用它。我肯定在他们做之前不会采取行动。

#2


Because major libraries that my codebase depends upon have not released a 3.x version. (wxPython, matplotlib, numpy, etc.)

因为我的代码库所依赖的主要库尚未发布3.x版本。 (wxPython,matplotlib,numpy等)

So the responsibility goes upstream from my point of view.

所以责任从我的角度出发上行。

If all my dependencies were 3.x compatible, I'd probably have switched by now.

如果我的所有依赖项都是3.x兼容的,我现在可能已经切换了。

#3


  1. Compiled 3rd party modules haven't updated.
  2. 编译的第三方模块尚未更新。

  3. Different syntax
  4. Slower integers.
  5. The #python IRC channel on freenode has in its title that its too early to switch.
  6. freenode上的#python IRC频道在其标题中说它太早转换。

#4


3rd party tools and libraries. I'm having trouble making some things work under 2.6 (not a LOT of trouble, mind you, but some.)

第三方工具和库。我无法让一些东西在2.6以下工作(不是很麻烦,请注意,但有些。)

As I see it, the ecosystem is one of Python's biggest strengths, and going to 3.0 at this point chucks a lot of that out the window. (In a year, I'm sure the story will be totally different.)

正如我所看到的那样,生态系统是Python最大的优势之一,此时达到3.0只能消除掉窗外的大部分内容。 (在一年中,我确信这个故事会完全不同。)

(Obviously, there's a chicken and egg problem here, but fortunately it's not my problem to solve, so I'll stay with 2.6 for a while.)

(显然,这里有一个鸡和鸡蛋的问题,但幸运的是,这不是我的问题,所以我会在2.6下呆一会儿。)

#5


For many of the python-based questions here, people are giving solutions that simply do not work in python 3.x.

对于许多基于python的问题,人们提供的解决方案根本不适用于python 3.x.

I think you answered your own question here. The lack of backwards compatibility makes 3.0 a much harder sell than a seamless upgrade because you have to adjust your thinking and discard some programming techniques to use the new version.

我想你在这里回答了你自己的问题。缺乏向后兼容性使3.0比无缝升级更难卖,因为你必须调整你的想法并放弃一些编程技术来使用新版本。

Call me back when they have an upgrade script for my brain.

当他们有我的大脑升级脚本时给我回电话。

#6


Because the default installation of 2.5 on Mac OSX Leopard works just fine. I have no need to upgrade and I see no advantage to upgrading except an end to the woes of unicode.

因为Mac OSX Leopard上的默认安装2.5工作得很好。我没有必要升级,除了结束unicode的困境之外,我认为升级没有任何优势。

#7


If you are interested to move to Py3k one interesting way would be to write code in Py3k and use a 3to2 script which is being written now as a part of Google Summer of code project, on the lines of 2to3 script.

如果您有兴趣转移到Py3k,一个有趣的方法是在Py3k中编写代码并使用3to2脚本,该脚本现在作为Google Summer of code项目的一部分编写,基于2to3脚本。

#8


The operating system I use the most, Debian, does not have a Python 3 package, not even in the "unstable" (brand new) branch. Unless I compile it myself (which is quite 20th century), it means no Python3 to me.

我使用最多的操作系统Debian没有Python 3软件包,甚至在“不稳定”(全新)分支中也没有。除非我自己编译(这是20世纪),否则对我来说意味着没有Python3。

I bet it is the same issue with many operating systems.

我敢打赌,许多操作系统都存在同样的问题。

#9


Unfortunately, for the same reason as most others have said - 3rd party libraries still not having been made 3.0 compatible. For this reason, as well as that some GNU/Linux distributions (Ubuntu in my case) still comes with Python 2.6, I can't completely throw 2.x out the window yet.

不幸的是,出于与其他大多数人所说的相同的原因 - 第三方库仍然没有与3.0兼容。出于这个原因,除了一些GNU / Linux发行版(在我的情况下是Ubuntu)仍然附带Python 2.6,我还不能完全抛出2.x窗口。

However, the change to 3.0 is not a major one IMO. Except for "print" being a function and the new string formatting system, it's really more or less the same as before.

但是,改为3.0并不是IMO的主要内容。除了作为函数的“print”和新的字符串格式化系统之外,它实际上或多或少与以前相同。

In fact, I find that most of my old scripts (those that do not depend on 3.0 incompatible 3rd party libraries) will work flawlessly in 3.0 after I update all the prints and string formatting. In some cases I've also had to change some module names (specifically stuff from the "email" module), but other than that nothing major.

实际上,我发现在更新所有打印和字符串格式后,我的大多数旧脚本(那些不依赖于3.0不兼容的第三方库)将在3.0中完美运行。在某些情况下,我还必须更改一些模块名称(特别是“电子邮件”模块中的内容),但除此之外没什么大不了的。

Also, all the scripts I have updated for 3.x compatibility so far still seem to work flawlessly in 2.6 (but not older 2.x of course, as they lack the new 3.x syntax).

此外,到目前为止我为3.x兼容性更新的所有脚本似乎仍然在2.6中完美运行(但当然不是较旧的2.x,因为它们缺少新的3.x语法)。

#10


The main reason I am not switching is that so many books and coding challenge websites are still 2.x. I installed 3.x and realized very quickly that I had to uninstall and go to 2.x.

我没有转换的主要原因是,许多书籍和编码挑战网站仍然是2.x.我安装了3.x并很快意识到我必须卸载并转到2.x.

#11


Because of the lack of backward compatibility, switching is hard, especially if there is C code involved. And although I understand the unicode/string thing may be very useful to some people, I certainly don't care about it myself.

由于缺乏向后兼容性,切换很难,特别是如果涉及C代码。虽然我理解unicode / string对某些人来说可能非常有用,但我自己并不关心它。

Basically, Py3k did not solve many problem that I care about (distribution issues, versioning of modules, simplified import model).

基本上,Py3k没有解决我关心的许多问题(分发问题,模块版本化,简化导入模型)。

#12


Python 3+ does not support numpy. Correction: it now does. As it now supports mathplotlib.

Python 3+不支持numpy。更正:现在确实如此。因为它现在支持mathplotlib。