用Python 3000编程 [英] programming with Python 3000 in mind

查看:74
本文介绍了用Python 3000编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www-03.ibm。 com / developerworks ... age / davidmertz David

Mertz写道


大概是2.7(以及后来的2.x版本),将有一种方法可以警告开发人员可能会导致移植的构造问题[来自Python 3000]
问题。在最简单的情况下,这将包括

已弃用的函数和语法结构。但可能是警告

可能涵盖潜在问题。就像上面的例子一样。


目前的Python测试版是2.5。 Python程序员怎样才能最大限度地减少在
Python 3000中运行代码所需的更改次数?一般来说,他应该知道什么是从$ 3000 $ b Python 3000中删除的,如果可能的话,使用现代的Python中的类比。但是,程序员的
经理可能需要外部证据来证明

便携性(例如没有翻译警告)。


一些基本的语法,比如


print" hello world"


正在消失,使打印看起来像一个函数。 IMO,因为BDFL的审美品味而修复了什么是没有损坏的是一个坏主意。

他的推理是在
http://mail.python.org/pipermail/pyt ...呃/ 056154.html

..

At http://www-03.ibm.com/developerworks...age/davidmertz David
Mertz writes

"Presumably with 2.7 (and later 2.x versions), there will be a means of
warning developers of constructs that are likely to cause porting
issues [to Python 3000]. In the simplest case, this will include
deprecated functions and syntax constructs. But presumably the warnings
may cover "potential problems" like the above example."

The current beta version of Python is 2.5 . How can a Python programmer
minimize the number of changes that will be needed to run his code in
Python 3000? In general, he should know what is being removed from
Python 3000 and if possible use the "modern" analogs in Python. A
manager of Python programmers might want external evidence of
portability, though (such as an absence of interpreter warnings).

Some basic syntax such as

print "hello world"

is going away to make print look like a function. IMO, fixing what is
not broken because of the aesthetic tastes of the BDFL is a bad idea.
His reasoning is at
http://mail.python.org/pipermail/pyt...er/056154.html
..

推荐答案


> Python的当前测试版本为2.5。 Python程序员如何最大限度地减少在Python 3000中运行代码所需的更改次数?
>The current beta version of Python is 2.5 . How can a Python
programmer minimize the number of changes that will be needed to run
his code in Python 3000?



因为我们还不知道Python 3000会是什么样子(它仍然非常好

早期发展),这是一个今天无法回答的问题。


Skip

Since we don''t know what Python 3000 will look like yet (it''s still in very
early development), that is a question that can''t be answered today.

Skip



< a href =mailto:be ******* @ aol.com>是******* @ aol.com ha escrito:

be*******@aol.com ha escrito:

http:// www-03。 ibm.com/developerworks...age/davidmertz David

Mertz写道


大概是2.7(以及后来的2.x版本) ),将会有一种方法可以警告开发人员可能会导致移植的构造问题[到Python 3000]。在最简单的情况下,这将包括

已弃用的函数和语法结构。但可能是警告

可能涵盖潜在问题。就像上面的例子一样。


目前的Python测试版是2.5。 Python程序员怎样才能最大限度地减少在
Python 3000中运行代码所需的更改次数?一般来说,他应该知道什么是从$ 3000 $ b Python 3000中删除的,如果可能的话,使用现代的Python中的类比。但是,程序员的
经理可能需要外部证据来证明

便携性(例如没有翻译警告)。


一些基本的语法,比如


print" hello world"


正在消失,使打印看起来像一个函数。 IMO,因为BDFL的审美品味而修复了什么是没有损坏的是一个坏主意。

他的推理是在
http://mail.python.org/pipermail/pyt ...呃/ 056154.html


At http://www-03.ibm.com/developerworks...age/davidmertz David
Mertz writes

"Presumably with 2.7 (and later 2.x versions), there will be a means of
warning developers of constructs that are likely to cause porting
issues [to Python 3000]. In the simplest case, this will include
deprecated functions and syntax constructs. But presumably the warnings
may cover "potential problems" like the above example."

The current beta version of Python is 2.5 . How can a Python programmer
minimize the number of changes that will be needed to run his code in
Python 3000? In general, he should know what is being removed from
Python 3000 and if possible use the "modern" analogs in Python. A
manager of Python programmers might want external evidence of
portability, though (such as an absence of interpreter warnings).

Some basic syntax such as

print "hello world"

is going away to make print look like a function. IMO, fixing what is
not broken because of the aesthetic tastes of the BDFL is a bad idea.
His reasoning is at
http://mail.python.org/pipermail/pyt...er/056154.html
.



查看此内容:
http://video.google.com/videoplay?do...39159268485356


另外,您可以进行简单的Google搜索: guido python 3000

有很多信息。


希望这会有所帮助...

LUIS

Check this out:
http://video.google.com/videoplay?do...39159268485356

Additionaly, you can make a simple Google search: "guido python 3000"
There is quite a lot of information.

Hope this helps...
LUIS



是****** *@aol.com 写道:

Python的当前测试版本为2.5。 Python程序员怎样才能最大限度地减少在
Python 3000中运行代码所需的更改次数?一般来说,他应该知道什么是从$ 3000 $ b Python 3000中删除的,如果可能的话,使用现代的Python中的类比。但是,程序员的
经理可能需要外部证据来证明

的可移植性(例如没有解释器警告)。
The current beta version of Python is 2.5 . How can a Python programmer
minimize the number of changes that will be needed to run his code in
Python 3000? In general, he should know what is being removed from
Python 3000 and if possible use the "modern" analogs in Python. A
manager of Python programmers might want external evidence of
portability, though (such as an absence of interpreter warnings).



你可能想看看PEP-3100,它概述了可能的
变化。您还可以按照python-3000邮件

列表中的讨论进行操作。从我的阅读中看,看起来会有相对较少的变化。

You might want to have a look at PEP-3100 which outlines possible
changes. You can also follow the discussion on the python-3000 mailing
list. From my reading of this, it looks like there will be relatively
few changes.


一些基本的语法,如


打印你好世界


即将消失,使打印看起来像一个功能。 IMO,因为BDFL的审美品味而修复了什么是没有损坏的是一个坏主意。

他的推理是在
http://mail.python.org/pipermail/pyt ...呃/ 056154.html



我没有看到他的主要推理与审美情趣有关,但是

而不是功能之一。实际上,如果你在

代码中使用print(对于调试非常有用:-),你就会坚持下去。如果打印

是一个函数,你可以随意重新定义它,并且可以非常轻松地在模块基础上重新定义它,也许可以将输出重定向到

日志记录或GvR描述的其他原因。

说到*教学/学习* Python,它更有意义

将print()作为一个函数(与exec相同)给出它的作用

-与其他关键字的目的相比。 [我不确定我会做什么

带输入()虽然...]


最后,即使我不同意以上

的特征这个变化与BDFL的审美品味有关,从我读到的b $ b $看起来他的口味经常是爆炸性的来自经验丰富的程序员的一致意见

;作为一个自己的业余爱好者,我非常惊讶于Python代码的读取和解密是多么容易,

与其他语言相比。

$ b $bAndré

I don`t see his main reasoning as related to aesthetic taste, but
rather as one of functionality. As it is, if you use print in your
code (very useful for debugging:-), you''re stuck with it. If print
were a function, you could redefine it at will and very easily, on a
module by module basis, perhaps redirecting the output to a file for
logging or other reasons as described by GvR.

When it comes to *teaching/learning* Python, it makes much more sense
to have print() as a function (same with exec) given what it does
-compared with the purpose of the other keywords. [I''m not sure I''d do
away with input() though...]

Finally, even though I disagreed above with the characterisation of
this change being related to the "aesthetic tastes of the BDFL", from
what I read it appears that his taste is most often bang-on with the
consensus from experienced programmers; as just a hobbyist myself, I am
constantly amazed at how easy Python code is to read and decipher,
compared with other languages.

André


这篇关于用Python 3000编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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