开发者

python 2.x or 3.x [closed]

开发者 https://www.devze.com 2023-01-07 22:37 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center f开发者_StackOverflowor guidance. Closed 10 years ago.

Since there is a python 3.x, why don't we use it?

Why do we still use 2.x?

What's the difference?


Python 2.6 and 2.7 have been written to ease the transition to Python 3. It will take some more time to port the more complex packages (i.e. those with many dependencies, or libraries written in C).

So if you are starting new projects, and all the libraries you need are there, it makes sense to start with 3.1. One of the more welcome changes is the handling of Unicode strings by default - it will prevent a lot of bugs.

But if you were to port a complete ERP application, or anything big, from 2.6 to 3.x, it could be a bloodbath right now. The unicode changes for instance are the hardest to apply from 2.x -> 3.x, and the low level C APIs have changed a lot as well.


Because 3.x isn't backwards compatible with 2.x and a lot of apps and libraries are written for the 2.x series. 3.x was their attempt at cleaning up all the crud that never should have been in Python in the first place.... and they had to make some breaking changes. Probably best to stick with 2.x for now, til 3.x gains a bit more popularity.


The biggest differences are listed in the documentation of Python.

Hth. :)


If you're writing a new app, and don't rely on libraries that have no 3.x support yet, I suggest you go for 3.x. Let's create some critical mass :)

Take a look at the python 3 documentation itself


Because lots of libraries are not yet ported to 3.x I guess... And because lots of application still run on 2.x

0

精彩评论

暂无评论...
验证码 换一张
取 消