General Python FAQ(1 General Information)[翻译]
原文地址:http://www.python.org/doc/faq/general.html
翻译:Justin Zhao (http://zzhouj.blogone.net/)
General Python FAQ
一般Python FAQ
Date: 2003-10-22
Version: 1.15
Web site: http://www.python.org/
Contents
目录
1 General Information
1 一般信息
1.1 What is Python?
1.1 什么是Python?
1.2 Why was Python created in the first place?
1.2 一开始,为什么要创造Python?
1.3 What is Python good for?
1.3 Python擅长做什么?
1.4 How does the Python version numbering scheme work?
1.4 Python的版本号是如何安排的?
1.5 Are there copyright restrictions on the use of Python?
1.5 使用Python有版权限制吗?
1.6 How do I obtain a copy of the Python source?
1.6 如何获得Python的源代码拷贝?
1.7 How do I get documentation on Python?
1.7 如何获得Python的文档?
1.8 I've never programmed before. Is there a Python tutorial?
1.8 我以前从未编过程。有Python的指南吗?
1.9 Are there other FTP sites that mirror the Python distribution?
1.9 有其他ftp站点给python的分发做镜像吗?
1.10 Is there a newsgroup or mailing list devoted to Python?
1.10 有专注于Python的新闻组或邮件列表吗?
1.11 How do I get a beta test version of Python?
1.11 如何获得Python的beta测试版?
1.12 How do I submit bug reports and patches for Python?
1.12 如何为Python提交bug报告和补丁?
1.13 Are there any published articles about Python that I can reference?
1.13 有我能参考的公开发表的Python文章吗?
1.14 Are there any books on Python?
1.14 有关于Python的书籍吗?
1.15 Where in the world is www.python.org located?
1.15 www.python.org位于世界的哪里?
1.16 Why is it called Python?
1.16 为什么叫Python?
1.17 Do I have to like "Monty Python's Flying Circus"?
1.17 我必须喜欢"Monty Python's Flying Circus"吗?
1 General Information
1 一般信息
1.1 What is Python?
1.1 什么是Python?
Python is an interpreted, interactive, object-oriented programming language. It
incorporates modules, exceptions, dynamic typing, very high level dynamic data types,
and classes. Python combines remarkable power with very clear syntax. It has interfaces
to many system calls and libraries, as well as to various window systems, and is
extensible in C or C++. It is also usable as an extension language for applications that
need a programmable interface. Finally, Python is portable: it runs on many Unix
variants, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2.
Python是解释型的、交互型的、面向对象的编程语言。她包含了模块、异常、动态型别,
十分高级的动态数据类型以及类别。Python将非凡的功能和十分清晰的语法整合在一起。
她拥有许多系统调用和程序库的接口,包括各种窗口系统,而且可以在C或者C++中对其
进行扩展。她也可以作为扩展语言使用于需要编程接口的应用程序中。最后,Python是可
移植的:她运行于许多Unix的变种、Mac和基于MS-DOS的PC、Windows、Windows NT
以及OS/2。
To find out more, start with the Beginner's Guide to Python.
如需更多信息,请参考Beginner's Guide to Python。
1.2 Why was Python created in the first place?
1.2 一开始,为什么要创造Python?
Here's a very brief summary of what started it all, written by Guido van Rossum:
这里有一段Guido van Rossum写的十分简短的概要,描述这是如何开始的:
I had extensive experience with implementing an interpreted language in the ABC group
at CWI, and from working with this group I had learned a lot about language design.
This is the origin of many Python features, including the use of indentation for statement
grouping and the inclusion of very-high-level data types (although the details are all
different in Python).
在CWI的ABC小组时,我在解释型语言的实现上拥有广泛的经验,并且在工作中学到了
很多语言设计的知识。许多python的特性就源自于此,包括使用缩进对语句进行分组以及
包含十分高级的数据类型(虽然在Python中细节完全不同)。
I had a number of gripes about the ABC language, but also liked many of its features. It
was impossible to extend the ABC language (or its implementation) to remedy my
complaints -- in fact its lack of extensibility was one of its biggest problems. I had some
experience with using Modula-2+ and talked with the designers of Modula-3 and read
the Modula-3 report. Modula-3 is the origin of the syntax and semantics used for
exceptions, and some other Python features.
对于ABC语言我有许多苦恼,但同样喜欢她的许多特性。但是不可能通过扩展ABC语言
(或者她的实现)来满足我的要求--事实上,缺乏可扩展性是其最大的问题。我有一些使用
Modula-2+的经验,并且同Modula-3的设计者们进行过交流,还阅读过Modula-3的报告。
用于异常和其他一些Python的特性的语法和语义就源自Modula-3。
I was working in the Amoeba distributed operating system group at CWI. We needed a
better way to do system administration than by writing either C programs or Bourne
shell scripts, since Amoeba had its own system call interface which wasn't easily
accessible from the Bourne shell. My experience with error handling in Amoeba made
me acutely aware of the importance of exceptions as a programming language feature.
我当时在CWI的Amoeba分布式操作系统小组工作。我们需要一种更好的办法来进行系统
管理,而不是通过编写C程序或者Bourne shell脚本,因为Amoeba的系统调用接口在
Bourne shell中调用不是很方便。我在Amoeba中的错误处理的经验使我强烈的意识到异常
作为一个编程语言特性的重要性。
It occurred to me that a scripting language with a syntax like ABC but with access to the
Amoeba system calls would fill the need. I realized that it would be foolish to write an
Amoeba-specific language, so I decided that I needed a language that was generally
extensible.
我突然想到,如果有一个脚本语言,她的语法类似ABC但是可以访问Amoeba的系统调用,
那么这个语言将满足需求。我认识到编写一种Amoeba专用语言是愚蠢的,所以我决定需
要一种具有广泛的可扩展性的语言。
During the 1989 Christmas holidays, I had a lot of time on my hand, so I decided to give
it a try. During the next year, while still mostly working on it in my own time, Python
was used in the Amoeba project with increasing success, and the feedback from
colleagues made me add many early improvements.
在1989年圣诞节假日期间,我手上有了很多时间,所以我决定试着去实现这个构想。在接
下来的一年中,当我还在用业余时间进行开发的时候,Python已经被成功的运用到Amoeba
项目中,同时从同事那里得到的反馈使我添加了许多早期的改进。
In February 1991, after just over a year of development, I decided to post to USENET.
The rest is in the Misc/HISTORY file.
1991年2月,在进行了超过一年的开发之后,我决定将她提交到USENET。接下来的事记
录在文件Misc/HISTORY中。
1.3 What is Python good for?
1.3 Python擅长做什么?
Python is a high-level general-purpose programming language that can be applied to
many different classes of problems.
Python是一种高级的通用编程语言,能够用于解决许多不同种类的问题。
The language comes with a large standard library that covers areas such as string
processing (regular expressions, Unicode, calculating differences between files), Internet
protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP, CGI programming), software
engineering (unit testing, logging, profiling, parsing Python code), and operating system
interfaces (system calls, filesystems, TCP/IP sockets). Look at the table of contents for the
Library Reference to get an idea of what's available. A wide variety of third-party
extensions are also available. Consult the Python Package Index to find packages of
interest to you.
这种语言附带一个巨大的标准库,覆盖了许多领域:如字符串处理(正则表达式, Unicode, 文
件之间内容比较),英特网协议簇(HTTP, FTP, SMTP, XML-RPC, POP, IMAP, CGI编程),
软件工程(单元测试, 日志记录, profiling, Python代码分析)以及操作系统接口(系统调
用, 文件系统, TCP/IP套接字)。请参考the Library Reference的目录表格以知道有哪些库
可供使用。还有各种第三方扩展可供使用。请参考the Python Package Index查找你所感兴
趣的扩展包。
1.4 How does the Python version numbering scheme work?
1.4 Python的版本号是如何安排的?
Python versions are numbered A.B.C or A.B. A is the major version number -- it is only
incremented for really major changes in the language. B is the minor version number,
incremented for less earth-shattering changes. C is the micro-level -- it is incremented for
each bugfix release. See PEP 6 for more information about bugfix releases.
Python的版本被编号为A.B.C或者A.B。A表示主版本号--只有在语言做了重大的改进时
才增加。B表示副(次要)版本号,在语言做了较小的改进时增加。C是最低级版本号,在
每次bug修正版本发布时增加。需要有关bug修正版本的信息,请参考PEP 6。
Not all releases are bugfix releases. In the run-up to a new major release, a series of
development releases are made, denoted as alpha, beta, or release candidate. Alphas are
early releases in which interfaces aren't yet finalized; it's not unexpected to see an
interface change between two alpha releases. Betas are more stable, preserving existing
interfaces but possibly adding new modules, and release candidates are frozen, making
no changes except as needed to fix critical bugs.
不是所有的版本发布都是bug修正版本。在升级主版本号时的发布中,包含一系列的开发
版本的发布,他们被称为alpha、beta和预发布版本。alpha版本发布于早期,此时接口还
未最终确定;所以在两次alpha版本发布之间,接口的改变是很正常的。beta版本更加稳
定,已有接口将不再改变,但是有可能添加新的模块。预发布版本的接口已被冰封,除了修
改一些重大的bug之外不能做其他改动。
Alpha, beta and release candidate versions have an additional suffix. The suffix for an
alpha version is "aN" for some small number N, the suffix for a beta version is "bN" for
some small number N, and the suffix for a release candidate version is "cN" for some
small number N. In other words, all versions labeled 2.0aN precede the versions labeled
2.0bN, which precede versions labeled 2.0cN, and those precede 2.0.
alpha、beta和预发布的版本号有一个附加的后缀。alpha版本的后缀是"aN"(N为一些较
小的数),beta版本的后缀是"bN",预发布版本的后缀为"cN"。换句话说,所有2.0aN发布
于2.0bN之前,2.0bN先于2.0cN,而所有这些都先于2.0。
You may also find version numbers with a "+" suffix, e.g. "2.2+". These are unreleased
versions, built directly from the CVS trunk. In practice, after a final minor release is made,
the CVS trunk is incremented to the next minor version, which becomes the "a0" version,
e.g. "2.4a0".
你也许发现过有"+"后缀的版本号,如"2.2+"。这些是未发布版本,直接从CVS主干构建的。
在实践中,在一个最终的次要版本发布以后,CVS主干增加到下一个次要版本,并成为"a0"
版,如"2.4a0"。
See also the documentation for sys.version, sys.hexversion, and sys.version_info.
请参考sys.version, sys.hexversion, and sys.version_info之文档。
1.5 Are there copyright restrictions on the use of Python?
1.5 使用Python有版权限制吗?
Not really. You can do anything you want with the source, as long as you leave the
copyrights in and display those copyrights in any documentation about Python that you
produce. If you honor the copyright rules, it's OK to use Python for commercial use, to
sell copies of Python in source or binary form (modified or unmodified), or to sell
products that incorporate Python in some form. We would still like to know about all
commercial use of Python, of course.
这并非事实。你可以对源代码做任何你想做的事,只要你保留版权声明并在你制造的Python
的文档中显示这些版权。如果你尊重Python的版权规则,你可以将Python用于商业目的,
销售Python的源代码或二进制拷贝(修改或没有修改的),或者销售和Python以某种形式
捆绑的产品。当然,我们仍旧希望知道所有将Python用于商业目的案例。
See the PSF license page to find further explanations and a link to the full text of the
license.
请参考the PSF license page,那里有进一步的解释和一个指向此license全文的连接。
1.6 How do I obtain a copy of the Python source?
1.6 如何获得Python的源代码拷贝?
The latest Python source distribution is always available from python.org, at
http://www.python.org/download/. The latest development sources can be obtained
via anonymous CVS from SourceForge, at
http://www.sourceforge.net/projects/python.
最新的Python源代码分发包总是可以在python.org上找到,网址:
http://www.python.org/download/。最新的开发源代码可以通过匿名CVS从
SourceForge得到,网址:http://www.sourceforge.net/projects/python。
The source distribution is a gzipped tar file containing the complete C source, LaTeX
documentation, Python library modules, example programs, and several useful pieces of
freely distributable software. This will compile and run out of the box on most UNIX
platforms.
源代码分发包使用gzip压缩的打包文件,里面包含全部的C代码,LaTeX格式的文档,
Python库和模块,编程范例,以及一些有用的免费分发的软件。这可以在UNIX平台以外
进行编译并运行。
Older versions of Python are also available from python.org.
Python以前的版本也可以从python.org获得。
1.7 How do I get documentation on Python?
1.7 如何获得Python的文档?
All documentation is available on-line, starting at http://www.python.org/doc/.
所有的文档可以以在线形式提供,从这里开始:http://www.python.org/doc/。
The LaTeX source for the documentation is part of the source distribution. If you don't
have LaTeX, the latest Python documentation set is available by anonymous FTP in
various formats such as PostScript and HTML. Visit the above URL for links to the
current versions.
文档的LaTeX源码是随Python源代码一起分发的。如果你没有LaTeX,可以通过匿名fpt
得到各种格式(如PostScript和HTML)的Python最新文档。请访问上面的URL以获得
当前版本的连接。
1.8 I've never programmed before. Is there a Python tutorial?
1.8 我以前从未编过程。有Python的指南吗?
There are numerous tutorials and books available. Consult the Beginner's Guide to find
information for beginning Python programmers, including lists of tutorials.
有多本指南和书籍可供选择。请参考the Beginner's Guide以寻找适合初学的Python程序
员的信息,还包括指南的列表。
1.9 Are there other FTP sites that mirror the Python distribution?
1.9 有其他ftp站点给python的分发做镜像吗?
Consult the list of python.org mirrors at http://www.python.org/Mirrors.html.
请参考python.org的镜像站点列表,网址:http://www.python.org/Mirrors.html。
1.10 Is there a newsgroup or mailing list devoted to Python?
1.10 有专注于Python的新闻组或邮件列表吗?
There is a newsgroup, comp.lang.python, and a mailing list, python-list. The newsgroup
and mailing list are gatewayed into each other -- if you can read news it's unnecessary to
subscribe to the mailing list. comp.lang.python is high-traffic, receiving hundreds of
postings every day, and Usenet readers are often more able to cope with this volume.
有一个新闻组:comp.lang.python和一个邮件列表:python-list。新闻组和邮件列表是互
相连通的--如果你可以阅读新闻就不同再去订阅邮件列表了。comp.lang.python的流量很
高,每天会收到上百封帖子,Usenet用户常常更有能力应付这个数量。
Announcements of new software releases and events can be found in
comp.lang.python.announce, a low-traffic moderated list that receives about five
postings per day. It's available as the python-announce mailing list.
新的软件发布和一些事件的发生的公告能够在comp.lang.python.announce中找到,这是
一个低流量的适中的列表,每天大概收到5封帖子。这些公告也能在the python-announce
mailing list中订阅。
More info about other mailing lists and newsgroups can be found at
http://www.python.org/community/lists.html.
更多有关邮件列表和新闻组的信息可以从如下网址获得:
http://www.python.org/community/lists.html。
1.11 How do I get a beta test version of Python?
1.11 如何获得Python的beta测试版?
All releases, including alphas, betas and release candidates, are announced on the
comp.lang.python and comp.lang.python.announce newsgroups. All announcements
also appear on the Python home page, at http://www.python.org/; an RSS feed of
news is available.
所有的发布版本,包括alpha、beta和预发布,都被公告于comp.lang.python和
comp.lang.python.announce新闻组中。所有的公告也会出现在Python的主页上,
http://www.python.org/;同时提供RSS feed。
You can also access the development version of Python through CVS. See
http://sourceforge.net/cvs/?group_id=5470 for details. If you're not familiar with CVS,
documents such as
http://linux.oreillynet.com/pub/a/linux/2002/01/03/cvs_intro.html provide an
introduction.
你也可以通过CVS访问Python的开发版本。详细情况请参考:
http://sourceforge.net/cvs/?group_id=5470。如果你不熟悉CVS,象
http://linux.oreillynet.com/pub/a/linux/2002/01/03/cvs_intro.html这样的文档可以提
供一个简介。
1.12 How do I submit bug reports and patches for Python?
1.12 如何为Python提交bug报告和补丁?
To report a bug or submit a patch, please use the relevant service from the Python project
at SourceForge.
需要提交bug报告和补丁,请使用位于SourceForge的Python项目的相关服务。
Bugs: http://sourceforge.net/tracker/?group_id=5470&atid=105470
Patches: http://sourceforge.net/tracker/?group_id=5470&atid=305470
You must have a SourceForge account to report bugs; this makes it possible for us to
contact you if we have follow-up questions. It will also enable SourceForge to send you
updates as we act on your bug.
你必须拥有一个SourceForge的帐号来报告bug,这使得我们在需要继续询问的时候能够联
系上你。也使得SourceForge在我们对你的bug采取行动时能够给你发送有关的更新。
For more information on how Python is developed, consult the Python Developer's
Guide.
想了解Python的开发方式,请参考the Python Developer's Guide。
1.13 Are there any published articles about Python that I can reference?
1.13 有我能参考的公开发表的Python文章吗?
It's probably best to reference your favorite book about Python.
或许你最好参考你喜欢的Python书籍。
The very first article about Python is this very old article that's now quite outdated.
有关Python的第一篇文章是一篇非常陈旧的文章,现在已十分过时了。
Guido van Rossum and Jelke de Boer, "Interactively Testing Remote Servers Using the
Python Programming Language", CWI Quarterly, Volume 4, Issue 4 (December 1991),
Amsterdam, pp 283-303.
Guido van Rossum和Jelke de Boer,《使用Python编程语言进行交互式远程服务测试》,
CWI季刊,第4卷,第4期(1991年12月),阿姆斯特丹,283-303页。
1.14 Are there any books on Python?
1.14 有关于Python的书籍吗?
Yes, there are many, and more are being published. See the python.org Wiki at
http://www.python.org/cgi-bin/moinmoin/PythonBooks for a list.
是的,有很多,还有更多将要出版。请参考python.org的Wiki上的列表:
http://www.python.org/cgi-bin/moinmoin/PythonBooks。
You can also search online bookstores for "Python" and filter out the Monty Python
references; or perhaps search for "Python" and "language".
你也可以在线搜索"Python",并将涉及"Monty Python"的内容过滤掉。或者搜索"Python"
并加上"language"关键字。
1.15 Where in the world is www.python.org located?
1.15 www.python.org位于世界的哪里?
It's currently in Amsterdam, graciously hosted by XS4ALL. Thanks to Thomas Wouters
for his work in arranging python.org's hosting.
现在这个站点位于阿姆斯特丹,由XS4ALL提供支持主机。感谢Thomas Wouters为
python.org安排了主机站点。
1.16 Why is it called Python?
1.16 为什么叫Python?
At the same time he began implementing Python, Guido van Rossum was also reading
the published scripts from "Monty Python's Flying Circus" (a BBC comedy series from
the seventies, in the unlikely case you didn't know). It occurred to him that he needed a
name that was short, unique, and slightly mysterious, so he decided to call the language
Python.
在Guido van Rossum开始实现Python的同时,他也在阅读"Monty Python's Flying
Circus"的剧本(一个BBC从70年带开始播放的喜剧系列,你可能未必知道)。正要给这个
语言起一个简短的,独一无二的并略带神秘色彩的名字,所以他决定叫这个语言为Python。
1.17 Do I have to like "Monty Python's Flying Circus"?
1.17 我必须喜欢"Monty Python's Flying Circus"吗?
No, but it helps. :)
不,但是这会有所帮助。:)
zzhouj 发表于 >2003-10-27 17:08:33