Python 教程 - 我应该使用 2.x 还是 3.0? [英] Tutorial for Python - Should I use 2.x or 3.0?

查看:42
本文介绍了Python 教程 - 我应该使用 2.x 还是 3.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 3.0 处于测试阶段,最终版本即将发布.显然,普遍采用并最终取代 2.x 还需要一些时间.

Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.

我正在编写有关 Python 编程某些方面的教程.我想知道我是否应该在 Python 2.x 或 3.0 中执行此操作?(并不是说差别很大)

I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge)

2.x 教程现在可能更有用,但开始制作 3.0 教程会很好.

a 2.x tutorial is probably more useful now, but it would be nice to start producing 3.0 tutorials.

有人有想法吗?

(当然我可以两者都做,但我更愿意做一个)

(of course I could do both, but I would prefer to do one or the other)

推荐答案

从 2.x 开始.大多数现有库将在很长一段时间内使用 2.x.去年,Guido 自己说要两年"直到你需要学习 3.0;还有一年.个人认为会更长.在 2.x 上编写代码的人可以学习如何使用 2to3 工具并获得在两个版本上都可以运行的代码.没有 3to2,因此为 python 3 编写的代码的价值明显降低.

Start with 2.x. Most existing libraries will be on 2.x for a long time. Last year, Guido himself said that it would be "two years" until you needed to learn 3.0; there's still another year left. Personally, I think it will be longer. People writing code on 2.x can learn how to use the 2to3 tool and have code that works on both versions. There is no 3to2, so code written for python 3 is significantly less valuable.

更不用说让您的学生了解到他们的 Linux 计算机上未安装 python 3 是多么令人失望(/usr/bin/python"将是 python 2.x,用于至少在接下来的 5 年中),python 3 没有 django,python 3 没有 wxwindows,python 3 没有 GTK,python 3 没有 Twisted,python 3 没有 PIL……Python 的真正优势在于一直在其广泛的库集合中,而现在 Python 3 的库很少.

Thats not to mention how disappointing it will be for your students to learn that python 3 is not installed on their Linux computer ("/usr/bin/python" will be python 2.x for the next 5 years, at least), that there is no django for python 3, no wxwindows for python 3, no GTK for python 3, no Twisted for python 3, no PIL for python 3... the real strength of Python has always been in its extensive collection of libraries, and there are very few libraries for python 3 right now.

如果您的教程写得很好,您应该能够轻松地将其更新到 python 2.6、2.7,并最终更新到 python 3.

If your tutorial is well written, you should easily be able to update it to python 2.6, 2.7, and eventually python 3.

这篇关于Python 教程 - 我应该使用 2.x 还是 3.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆