478 lines
44 KiB
HTML
478 lines
44 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_CN">
|
||
<head>
|
||
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>Python常见问题 — Python 3.8.20 文档</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
||
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<script src="../_static/translations.js"></script>
|
||
|
||
<script src="../_static/sidebar.js"></script>
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml"
|
||
title="在 Python 3.8.20 文档 中搜索"
|
||
href="../_static/opensearch.xml"/>
|
||
<link rel="author" title="关于这些文档" href="../about.html" />
|
||
<link rel="index" title="索引" href="../genindex.html" />
|
||
<link rel="search" title="搜索" href="../search.html" />
|
||
<link rel="copyright" title="版权所有" href="../copyright.html" />
|
||
<link rel="next" title="编程常见问题" href="programming.html" />
|
||
<link rel="prev" title="Python 常见问题" href="index.html" />
|
||
<link rel="canonical" href="https://docs.python.org/3/faq/general.html" />
|
||
|
||
|
||
|
||
|
||
|
||
<style>
|
||
@media only screen {
|
||
table.full-width-table {
|
||
width: 100%;
|
||
}
|
||
}
|
||
</style>
|
||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
||
<script type="text/javascript" src="../_static/menu.js"></script>
|
||
|
||
</head>
|
||
<body>
|
||
<div class="mobile-nav">
|
||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
||
<label for="menuToggler" class="toggler__label">
|
||
<span></span>
|
||
</label>
|
||
<nav class="nav-content" role="navigation">
|
||
<a href="https://www.python.org/" class="nav-logo">
|
||
<img src="../_static/py.svg" alt="Logo"/>
|
||
</a>
|
||
<div class="version_switcher_placeholder"></div>
|
||
<form role="search" class="search" action="../search.html" method="get">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
||
<path fill-rule="nonzero"
|
||
d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" fill="#444"></path>
|
||
</svg>
|
||
<input type="text" name="q" aria-label="快速搜索"/>
|
||
<input type="submit" value="转向"/>
|
||
</form>
|
||
</nav>
|
||
<div class="menu-wrapper">
|
||
<nav class="menu" role="navigation" aria-label="main navigation">
|
||
<div class="language_switcher_placeholder"></div>
|
||
<h3><a href="../contents.html">目录</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Python常见问题</a><ul>
|
||
<li><a class="reference internal" href="#general-information">一般信息</a></li>
|
||
<li><a class="reference internal" href="#python-in-the-real-world">现实世界中的 Python</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<h4>上一个主题</h4>
|
||
<p class="topless"><a href="index.html"
|
||
title="上一章">Python 常见问题</a></p>
|
||
<h4>下一个主题</h4>
|
||
<p class="topless"><a href="programming.html"
|
||
title="下一章">编程常见问题</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<h3>本页</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../bugs.html">报告 Bug</a></li>
|
||
<li>
|
||
<a href="https://github.com/python/cpython/blob/3.8/Doc/faq/general.rst"
|
||
rel="nofollow">显示源代码
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="outdated-warning" style="padding: .5em; text-align: center; background-color: #FFBABA; color: #6A0E0E;">
|
||
这个文档所针对的是一个已不再受支持的 Python 旧版本。
|
||
你应当升级版本,并阅读
|
||
<a href="/3/faq/general.html"> Python 当前稳定版本的文档</a>.
|
||
</div>
|
||
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>导航</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="总目录"
|
||
accesskey="I">索引</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python 模块索引"
|
||
>模块</a> |</li>
|
||
<li class="right" >
|
||
<a href="programming.html" title="编程常见问题"
|
||
accesskey="N">下一页</a> |</li>
|
||
<li class="right" >
|
||
<a href="index.html" title="Python 常见问题"
|
||
accesskey="P">上一页</a> |</li>
|
||
|
||
<li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||
<li class="switchers">
|
||
<div class="language_switcher_placeholder"></div>
|
||
<div class="version_switcher_placeholder"></div>
|
||
</li>
|
||
<li>
|
||
|
||
</li>
|
||
<li id="cpython-language-and-version">
|
||
<a href="../index.html">3.8.20 Documentation</a> »
|
||
</li>
|
||
|
||
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python 常见问题</a> »</li>
|
||
<li class="right">
|
||
|
||
|
||
<div class="inline-search" role="search">
|
||
<form class="inline-search" action="../search.html" method="get">
|
||
<input placeholder="快速搜索" aria-label="快速搜索" type="text" name="q" />
|
||
<input type="submit" value="转向" />
|
||
<input type="hidden" name="check_keywords" value="yes" />
|
||
<input type="hidden" name="area" value="default" />
|
||
</form>
|
||
</div>
|
||
|
|
||
</li>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="general-python-faq">
|
||
<h1><a class="toc-backref" href="#id3">Python常见问题</a><a class="headerlink" href="#general-python-faq" title="永久链接至标题">¶</a></h1>
|
||
<div class="contents topic" id="id1">
|
||
<p class="topic-title">目录</p>
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="#general-python-faq" id="id3">Python常见问题</a></p>
|
||
<ul>
|
||
<li><p><a class="reference internal" href="#general-information" id="id4">一般信息</a></p>
|
||
<ul>
|
||
<li><p><a class="reference internal" href="#what-is-python" id="id5">什么是 Python?</a></p></li>
|
||
<li><p><a class="reference internal" href="#what-is-the-python-software-foundation" id="id6">什么是 Python 软件基金会?</a></p></li>
|
||
<li><p><a class="reference internal" href="#are-there-copyright-restrictions-on-the-use-of-python" id="id7">使用 Python 是否存在版权限制?</a></p></li>
|
||
<li><p><a class="reference internal" href="#why-was-python-created-in-the-first-place" id="id8">创造 Python 的最初理由是什么?</a></p></li>
|
||
<li><p><a class="reference internal" href="#what-is-python-good-for" id="id9">Python 适合做什么?</a></p></li>
|
||
<li><p><a class="reference internal" href="#how-does-the-python-version-numbering-scheme-work" id="id10">Python 版本的编号形式是怎样的?</a></p></li>
|
||
<li><p><a class="reference internal" href="#how-do-i-obtain-a-copy-of-the-python-source" id="id11">我应如何获取一份 Python 源代码的副本?</a></p></li>
|
||
<li><p><a class="reference internal" href="#how-do-i-get-documentation-on-python" id="id12">我应如何获取 Python 的文档?</a></p></li>
|
||
<li><p><a class="reference internal" href="#i-ve-never-programmed-before-is-there-a-python-tutorial" id="id13">我之前从未接触过编程。 哪里有 Python 的教程?</a></p></li>
|
||
<li><p><a class="reference internal" href="#is-there-a-newsgroup-or-mailing-list-devoted-to-python" id="id14">是否有专门针对 Python 的新闻组或邮件列表?</a></p></li>
|
||
<li><p><a class="reference internal" href="#how-do-i-get-a-beta-test-version-of-python" id="id15">我应如何获取 Python 的公开测试版本?</a></p></li>
|
||
<li><p><a class="reference internal" href="#how-do-i-submit-bug-reports-and-patches-for-python" id="id16">我应如何为 Python 提交错误报告和补丁?</a></p></li>
|
||
<li><p><a class="reference internal" href="#are-there-any-published-articles-about-python-that-i-can-reference" id="id17">是否有任何公开发表的 Python 相关文章可以供我参考引用?</a></p></li>
|
||
<li><p><a class="reference internal" href="#are-there-any-books-on-python" id="id18">是否有任何 Python 相关的书籍?</a></p></li>
|
||
<li><p><a class="reference internal" href="#where-in-the-world-is-www-python-org-located" id="id19">www.python.org 具体位于世界上的哪个地点?</a></p></li>
|
||
<li><p><a class="reference internal" href="#why-is-it-called-python" id="id20">为何命名为 Python?</a></p></li>
|
||
<li><p><a class="reference internal" href="#do-i-have-to-like-monty-python-s-flying-circus" id="id21">我必须喜欢 "Monty Python 的飞行马戏团" 吗?</a></p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><a class="reference internal" href="#python-in-the-real-world" id="id22">现实世界中的 Python</a></p>
|
||
<ul>
|
||
<li><p><a class="reference internal" href="#how-stable-is-python" id="id23">Python 有多稳定?</a></p></li>
|
||
<li><p><a class="reference internal" href="#how-many-people-are-using-python" id="id24">有多少人在使用 Python?</a></p></li>
|
||
<li><p><a class="reference internal" href="#have-any-significant-projects-been-done-in-python" id="id25">有哪些重要的项目是用 Python 开发的?</a></p></li>
|
||
<li><p><a class="reference internal" href="#what-new-developments-are-expected-for-python-in-the-future" id="id26">在未来可以期待 Python 将有什么新进展?</a></p></li>
|
||
<li><p><a class="reference internal" href="#is-it-reasonable-to-propose-incompatible-changes-to-python" id="id27">提议对 Python 加入不兼容的更改是否合理?</a></p></li>
|
||
<li><p><a class="reference internal" href="#is-python-a-good-language-for-beginning-programmers" id="id28">Python 是一种对编程初学者友好的语言吗?</a></p></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<section id="general-information">
|
||
<h2><a class="toc-backref" href="#id4">一般信息</a><a class="headerlink" href="#general-information" title="永久链接至标题">¶</a></h2>
|
||
<section id="what-is-python">
|
||
<h3><a class="toc-backref" href="#id5">什么是 Python?</a><a class="headerlink" href="#what-is-python" title="永久链接至标题">¶</a></h3>
|
||
<p>Python 是一种解释型、交互式、面向对象的编程语言。 它包含了模块、异常、动态类型、高层级动态数据类型以及类等特性。 在面向对象编程以外它还支持多种编程范式,例如过程式和函数式编程等。 Python 结合了超强的功能和极清晰的语法。 它带有许多系统调用和库以及多种窗口系统的接口,并且能用 C 或 C++ 来进行扩展。 它还可用作需要可编程接口的应用程序的扩展语言。 最后,Python 非常易于移植:它可以在包括 Linux 和 macOS 在内的许多 Unix 变种以及 Windows 上运行。</p>
|
||
<p>要了解更多详情,请先查看 <a class="reference internal" href="../tutorial/index.html#tutorial-index"><span class="std std-ref">Python 教程</span></a>。 <a class="reference external" href="https://wiki.python.org/moin/BeginnersGuide">Python 新手指南</a> 提供了学习 Python 的其他入门教程及资源的链接。</p>
|
||
</section>
|
||
<section id="what-is-the-python-software-foundation">
|
||
<h3><a class="toc-backref" href="#id6">什么是 Python 软件基金会?</a><a class="headerlink" href="#what-is-the-python-software-foundation" title="永久链接至标题">¶</a></h3>
|
||
<p>Python 软件基金会(Python Software Foundation,简称 PSF)是一个独立的非盈利组织,它拥有 Python 2.1 及以上各版本的版权。 PSF 的使命是推进与 Python 编程语言相关的开源技术,并推广 Python 的使用。 PSF 的主页是 <a class="reference external" href="https://www.python.org/psf/">https://www.python.org/psf/</a>。</p>
|
||
<p>向 PSF 提供捐助在美国是免税的。 如果你在使用 Python 并且感觉它对你很有帮助,可以通过 <a class="reference external" href="https://www.python.org/psf/donations/">PSF 捐助页</a> 进行捐助。</p>
|
||
</section>
|
||
<section id="are-there-copyright-restrictions-on-the-use-of-python">
|
||
<h3><a class="toc-backref" href="#id7">使用 Python 是否存在版权限制?</a><a class="headerlink" href="#are-there-copyright-restrictions-on-the-use-of-python" title="永久链接至标题">¶</a></h3>
|
||
<p>你可以任意使用源码,只要你保留版权信息并在你基于 Python 的产品文档中显示该版权信息。 如果你遵守此版权规则,就可以将 Python 用于商业领域,以源码或二进制码的形式(不论是否经过修改)销售 Python 的副本,或是以某种形式包含了 Python 的产品。 当然,我们仍然希望获知所有对 Python 的商业使用。</p>
|
||
<p>请参阅 <a class="reference external" href="https://www.python.org/psf/license/">PSF 许可页</a> 以查看进一步的说明以及许可的完整文本内容的链接。</p>
|
||
<p>Python 的徽标是注册商标,在某些情况下需要获得允许方可使用。 请参阅 <a class="reference external" href="https://www.python.org/psf/trademarks/">商标使用政策</a> 了解详情。</p>
|
||
</section>
|
||
<section id="why-was-python-created-in-the-first-place">
|
||
<h3><a class="toc-backref" href="#id8">创造 Python 的最初理由是什么?</a><a class="headerlink" href="#why-was-python-created-in-the-first-place" title="永久链接至标题">¶</a></h3>
|
||
<p>以下是有关最初缘起的一份 <em>非常</em> 简短的摘要,由 Guido van Rossum 本人撰写:</p>
|
||
<blockquote>
|
||
<div><p>我在 CWI 的 ABC 部门时在实现解释型语言方面积累了丰富经验,通过与这个部门成员的协同工作,我学到了大量有关语言设计的知识。 这是许多 Python 特性的最初来源,包括使用缩进来组织语句以及包含非常高层级的数据结构(虽然在 Python 中具体的实现细节完全不同)。</p>
|
||
<p>我对 ABC 语言有过许多抱怨,但同时也很喜欢它的许多特性。 没有可能通过扩展 ABC 语言(或它的实现)来弥补我的不满 —— 实际上缺乏可扩展性就是它最大的问题之一。 我也有一些使用 Modula-2+ 的经验,并曾与 Modula-3 的设计者进行交流,还阅读了 Modula-3 的报告。 Modula-3 是 Python 中异常机制所用语法和语义,以及其他一些语言特性的最初来源。</p>
|
||
<p>我还曾在 CWI 的 Amoeba 分布式操作系统部门工作。 当时我们需要有一种比编写 C 程序或 Bash 脚本更好的方式来进行系统管理,因为 Amoeba 有它自己的系统调用接口,并且无法方便地通过 Bash 来访问。 我在 Amoeba 中处理错误的经验令我深刻地意识到异常处理在编程语言特性当中的重要地位。</p>
|
||
<p>我发现,某种具有 ABC 式的语法而又能访问 Amoeba 系统调用的脚本语言将可满足需求。 我意识到编写一种 Amoeba 专属的语言是愚蠢的,所以我决定编写一种具有全面可扩展性的语言。</p>
|
||
<p>在 1989 年的圣诞假期中,我手头的时间非常充裕,因此我决定开始尝试一下。 在接下来的一年里,虽然我仍然主要用我的业余时间来做这件事,但 Python 在 Amoeba 项目中的使用获得了很大的成功,来自同事的反馈让我得以增加了许多早期的改进。</p>
|
||
<p>到 1991 年 2 月,经过一年多的开发,我决定将其发布到 USENET。 之后的事情就都可以在 <code class="docutils literal notranslate"><span class="pre">Misc/HISTORY</span></code> 文件里面看了。</p>
|
||
</div></blockquote>
|
||
</section>
|
||
<section id="what-is-python-good-for">
|
||
<h3><a class="toc-backref" href="#id9">Python 适合做什么?</a><a class="headerlink" href="#what-is-python-good-for" title="永久链接至标题">¶</a></h3>
|
||
<p>Python 是一种高层级的多用途编程语言,可用于解决许多不同门类的问题。</p>
|
||
<p>该语言附带一个庞大的标准库,涵盖了字符串处理(正则表达式,Unicode,比较文件间的差异等),因特网协议(HTTP,FTP,SMTP,XML-RPC,POP,IMAP,CGI 编程等),软件工程(单元测试,日志记录,性能分析,Python 代码解析等),以及操作系统接口(系统调用,文件系统,TCP/IP 套接字等)。 请查看 <a class="reference internal" href="../library/index.html#library-index"><span class="std std-ref">Python 标准库</span></a> 的目录以了解所有可用的内容。 此外还可以获取到各种各样的第三方扩展。 请访问 <a class="reference external" href="https://pypi.org">Python 包索引</a> 来查找你感兴趣的软件包。</p>
|
||
</section>
|
||
<section id="how-does-the-python-version-numbering-scheme-work">
|
||
<h3><a class="toc-backref" href="#id10">Python 版本的编号形式是怎样的?</a><a class="headerlink" href="#how-does-the-python-version-numbering-scheme-work" title="永久链接至标题">¶</a></h3>
|
||
<p>Python 版本的编号形式是 A.B.C 或 A.B。 A 称为大版本号 —— 它仅在对语言特性进行非常重大改变时才会递增。 B 称为小版本号,它会在语言特性发生较小改变时递增。 C 称为微版本号 —— 它会在每次发布问题修正时递增。 请参阅 <span class="target" id="index-6"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0006"><strong>PEP 6</strong></a> 了解有关问题修正发布版的详情。</p>
|
||
<p>发布版本并非都是问题修正版本。 在新的主要发布版本开发过程中,还会发布一系列的开发版,它们以 alpha (a), beta (b) 或 release candidate (rc) 来标示。 其中 alpha 版是早期发布的测试版,它的接口并未最终确定;在两个 alpha 发布版本间出现接口的改变并不意外。 而 beta 版更为稳定,它会保留现有的接口,但也可能增加新的模块,release candidate 版则会保持冻结状态不会再进行改变,除非有重大问题需要修正。</p>
|
||
<p>以上 alpha, beta 和 release candidate 版本会附加一个后缀。 用于 alpha 版本的后缀是带有一个小数字 N 的 “aN”,beta 版本的后缀是带有一个小数字 N 的“bN”,release candidate 版本的后缀是带有一个小数字 N 的“cN”。 换句话说,所有标记为 2.0aN 的版本都早于标记为 2.0bN 的版本,后者又都早于标记为 2.0cN 的版本,而 <em>这些版本</em> 全都早于 2.0。</p>
|
||
<p>你还可能看到带有“+”后缀的版本号,例如“2.2+”。 这表示未发布版本,直接基于 CPython 开发代码仓库构建。 在实际操作中,当一个小版本最终发布后,未发布版本号会递增到下一个小版本号,成为“a0”版本,例如“2.4a0”。</p>
|
||
<p>另请参阅 <a class="reference internal" href="../library/sys.html#sys.version" title="sys.version"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.version</span></code></a>, <a class="reference internal" href="../library/sys.html#sys.hexversion" title="sys.hexversion"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.hexversion</span></code></a> 以及 <a class="reference internal" href="../library/sys.html#sys.version_info" title="sys.version_info"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.version_info</span></code></a> 的文档。</p>
|
||
</section>
|
||
<section id="how-do-i-obtain-a-copy-of-the-python-source">
|
||
<h3><a class="toc-backref" href="#id11">我应如何获取一份 Python 源代码的副本?</a><a class="headerlink" href="#how-do-i-obtain-a-copy-of-the-python-source" title="永久链接至标题">¶</a></h3>
|
||
<p>最新的 Python 发布版源代码总能从 python.org 获取,下载页链接为 <a class="reference external" href="https://www.python.org/downloads/">https://www.python.org/downloads/</a>。 最新的开发版源代码可以在 <a class="reference external" href="https://github.com/python/cpython/">https://github.com/python/cpython/</a> 获取。</p>
|
||
<p>发布版源代码是一个以 gzip 压缩的 tar 文件,其中包含完整的 C 源代码、Sphinx 格式的文档、Python 库模块、示例程序以及一些有用的自由分发软件。 该源代码将可在大多数 UNIX 类平台上直接编译并运行。</p>
|
||
<p>请参阅 <a class="reference external" href="https://devguide.python.org/setup/">Python 开发者指南的初步上手部分</a> 了解有关获取源代码并进行编译的更多信息。</p>
|
||
</section>
|
||
<section id="how-do-i-get-documentation-on-python">
|
||
<h3><a class="toc-backref" href="#id12">我应如何获取 Python 的文档?</a><a class="headerlink" href="#how-do-i-get-documentation-on-python" title="永久链接至标题">¶</a></h3>
|
||
<p>当前的 Python 稳定版本的标准文档可在 <a class="reference external" href="https://docs.python.org/3/">https://docs.python.org/3/</a> 查看。 也可在 <a class="reference external" href="https://docs.python.org/3/download.html">https://docs.python.org/3/download.html</a> 获取PDF、纯文本以及可下载的 HTML 版本。</p>
|
||
<p>文档以 reStructuredText 格式撰写,并使用 <a class="reference external" href="http://sphinx-doc.org/">Sphinx 文档工具</a> 生成。 文档的 reStructuredText 源文件是 Python 源代码发布版的一部分。</p>
|
||
</section>
|
||
<section id="i-ve-never-programmed-before-is-there-a-python-tutorial">
|
||
<h3><a class="toc-backref" href="#id13">我之前从未接触过编程。 哪里有 Python 的教程?</a><a class="headerlink" href="#i-ve-never-programmed-before-is-there-a-python-tutorial" title="永久链接至标题">¶</a></h3>
|
||
<p>有许多可选择的教程和书籍。 标准文档中也包含有 <a class="reference internal" href="../tutorial/index.html#tutorial-index"><span class="std std-ref">Python 教程</span></a>。</p>
|
||
<p>请参阅 <a class="reference external" href="https://wiki.python.org/moin/BeginnersGuide">新手指南</a> 以获取针对 Python 编程初学者的信息,包括教程的清单。</p>
|
||
</section>
|
||
<section id="is-there-a-newsgroup-or-mailing-list-devoted-to-python">
|
||
<h3><a class="toc-backref" href="#id14">是否有专门针对 Python 的新闻组或邮件列表?</a><a class="headerlink" href="#is-there-a-newsgroup-or-mailing-list-devoted-to-python" title="永久链接至标题">¶</a></h3>
|
||
<p>有一个新闻组 <em class="newsgroup">comp.lang.python</em> 和一个邮件列表 <a class="reference external" href="https://mail.python.org/mailman/listinfo/python-list">python-list</a>。 新闻组和邮件列表是彼此互通的 —— 如果你可以阅读新闻就不必再订阅邮件列表。 <em class="newsgroup">comp.lang.python</em> 的流量很大,每天会收到数以百计的发帖,Usenet 使用者通常更擅长处理这样大的流量。</p>
|
||
<p>有关新软件发布和活动的公告可以在 comp.lang.python.announce 中找到,这是个严格管理的低流量列表,每天会收到五个左右的发帖。 可以在 <a class="reference external" href="https://mail.python.org/mailman/listinfo/python-announce-list">Python 公告邮件列表</a> 页面进行订阅。</p>
|
||
<p>有关其他邮件列表和新闻组的更多信息可以在 <a class="reference external" href="https://www.python.org/community/lists/">https://www.python.org/community/lists/</a> 找到。</p>
|
||
</section>
|
||
<section id="how-do-i-get-a-beta-test-version-of-python">
|
||
<h3><a class="toc-backref" href="#id15">我应如何获取 Python 的公开测试版本?</a><a class="headerlink" href="#how-do-i-get-a-beta-test-version-of-python" title="永久链接至标题">¶</a></h3>
|
||
<p>可以从 <a class="reference external" href="https://www.python.org/downloads/">https://www.python.org/downloads/</a> 下载 alpha 和 beta 发布版。 所有发布版都会在 comp.lang.python 和 comp.lang.python.announce 新闻组以及 Python 主页 <a class="reference external" href="https://www.python.org/">https://www.python.org/</a> 上进行公告;并会推送到 RSS 新闻源。</p>
|
||
<p>你还可以通过 Git 访问 Python 的开发版。 请参阅 <a class="reference external" href="https://devguide.python.org/">Python 开发者指南</a> 了解详情。</p>
|
||
</section>
|
||
<section id="how-do-i-submit-bug-reports-and-patches-for-python">
|
||
<h3><a class="toc-backref" href="#id16">我应如何为 Python 提交错误报告和补丁?</a><a class="headerlink" href="#how-do-i-submit-bug-reports-and-patches-for-python" title="永久链接至标题">¶</a></h3>
|
||
<p>要报告错误或提交补丁,请使用安装于 <a class="reference external" href="https://bugs.python.org/">https://bugs.python.org/</a> 上的 Roundup。</p>
|
||
<p>你必须拥有一个 Roundup 账号才能报告错误;这样我们就可以在有后续问题时与你联系。 这也使得 Roundup 能在我们处理所报告的错误时向你发送更新消息。 如果你之前使用过 SourceForge 向 Python 报告错误,你可以通过 Roundup 的 <a class="reference external" href="https://bugs.python.org/user?@template=forgotten">密码重置操作</a> 来获取你的 Roundup 密码。</p>
|
||
<p>有关 Python 开发流程的更多信息,请参阅 <a class="reference external" href="https://devguide.python.org/">Python 开发者指南</a>。</p>
|
||
</section>
|
||
<section id="are-there-any-published-articles-about-python-that-i-can-reference">
|
||
<h3><a class="toc-backref" href="#id17">是否有任何公开发表的 Python 相关文章可以供我参考引用?</a><a class="headerlink" href="#are-there-any-published-articles-about-python-that-i-can-reference" title="永久链接至标题">¶</a></h3>
|
||
<p>可能作为参考文献的最好方式还是引用你喜欢的 Python 相关书籍。</p>
|
||
<p>第一篇有关 Python 的文章写于 1991 年,现在其内容已经相当过时了。</p>
|
||
<blockquote>
|
||
<div><p>Guido van Rossum 与 Jelke de Boer, "使用 Python 编程语言交互式地测试远程服务器", CWI 季刊, 第 4 卷, 第 4 期 (1991 年 12 月), 阿姆斯特丹, 第 283--303 页。</p>
|
||
</div></blockquote>
|
||
</section>
|
||
<section id="are-there-any-books-on-python">
|
||
<h3><a class="toc-backref" href="#id18">是否有任何 Python 相关的书籍?</a><a class="headerlink" href="#are-there-any-books-on-python" title="永久链接至标题">¶</a></h3>
|
||
<p>是的,相关的书籍很多,还有更多即将发行。 请访问 python.org 的 wiki 页面 <a class="reference external" href="https://wiki.python.org/moin/PythonBooks">https://wiki.python.org/moin/PythonBooks</a> 获取一份清单。</p>
|
||
<p>你也可以到各大在线书店搜索 "Python" 并过滤掉对 Monty Python 的引用;或者也可以搜索 "Python" 加 "language"。</p>
|
||
</section>
|
||
<section id="where-in-the-world-is-www-python-org-located">
|
||
<h3><a class="toc-backref" href="#id19">www.python.org 具体位于世界上的哪个地点?</a><a class="headerlink" href="#where-in-the-world-is-www-python-org-located" title="永久链接至标题">¶</a></h3>
|
||
<p>Python 项目的基础架构分布于世界各地并由 Python 基础架构团队负责管理。 详情请访问 <a class="reference external" href="http://infra.psf.io">这里</a>。</p>
|
||
</section>
|
||
<section id="why-is-it-called-python">
|
||
<h3><a class="toc-backref" href="#id20">为何命名为 Python?</a><a class="headerlink" href="#why-is-it-called-python" title="永久链接至标题">¶</a></h3>
|
||
<p>在着手编写 Python 实现的时候,Guido van Rossum 同时还阅读了刚出版的 <a class="reference external" href="https://en.wikipedia.org/wiki/Monty_Python">"Monty Python 的飞行马戏团"</a> 剧本,这是一部自 1970 年代开始播出的 BBC 系列喜剧。 Van Rossum 觉得他需要选择一个简短、独特而又略显神秘的名字,于是他决定将这个新语言命名为 Python。</p>
|
||
</section>
|
||
<section id="do-i-have-to-like-monty-python-s-flying-circus">
|
||
<h3><a class="toc-backref" href="#id21">我必须喜欢 "Monty Python 的飞行马戏团" 吗?</a><a class="headerlink" href="#do-i-have-to-like-monty-python-s-flying-circus" title="永久链接至标题">¶</a></h3>
|
||
<p>不必,但这对学习会有帮助。 :)</p>
|
||
</section>
|
||
</section>
|
||
<section id="python-in-the-real-world">
|
||
<h2><a class="toc-backref" href="#id22">现实世界中的 Python</a><a class="headerlink" href="#python-in-the-real-world" title="永久链接至标题">¶</a></h2>
|
||
<section id="how-stable-is-python">
|
||
<h3><a class="toc-backref" href="#id23">Python 有多稳定?</a><a class="headerlink" href="#how-stable-is-python" title="永久链接至标题">¶</a></h3>
|
||
<p>非常稳定。 自 1991 年起大约每隔 6 到 18 个月就会推出新的稳定发布版,这种状态看来还还持续。 从 3.9 版开始,Python 将会每隔 12 个月推出一个新的主要发布版 (<span class="target" id="index-7"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0602"><strong>PEP 602</strong></a>)。</p>
|
||
<p>开发者也会推出旧版本的“问题修正”发布版,因此现有发布版的稳定性还会逐步提升。 问题修正发布版会以版本号第三部分的数字来标示(例如 3.5.3, 3.6.2),用于稳定性的管理;只有对已知问题的修正会包含在问题修正发布版中,同一系列的问题修正发布版中的接口确定将会始终保持一致。</p>
|
||
<p>最新的稳定版本总是可以在 <a class="reference external" href="https://www.python.org/downloads/">Python 下载页面</a> 上找到。有两个生产环境可用的 Python 版本: 2.x 和 3.x。 推荐的版本是 3.x,大多数广泛使用的库都支持它。 虽然 2.x 仍然被广泛使用,但它 <a class="reference external" href="https://www.python.org/dev/peps/pep-0373/">在 2020 年 1 月 1 日之后将不再维护</a>。</p>
|
||
</section>
|
||
<section id="how-many-people-are-using-python">
|
||
<h3><a class="toc-backref" href="#id24">有多少人在使用 Python?</a><a class="headerlink" href="#how-many-people-are-using-python" title="永久链接至标题">¶</a></h3>
|
||
<p>使用者应该数以百万计,但很难获得一个精确的数字。</p>
|
||
<p>Python 可以免费下载,因此并不存在销量数据,此外它也可以从许多不同网站获取,并且包含于许多 Linux 发行版之中,因此下载量统计同样无法完全说明问题。</p>
|
||
<p>comp.lang.python 新闻组非常活跃,但不是所有 Python 用户都会在新闻组发帖,许多人甚至不会阅读新闻组。</p>
|
||
</section>
|
||
<section id="have-any-significant-projects-been-done-in-python">
|
||
<h3><a class="toc-backref" href="#id25">有哪些重要的项目是用 Python 开发的?</a><a class="headerlink" href="#have-any-significant-projects-been-done-in-python" title="永久链接至标题">¶</a></h3>
|
||
<p>请访问 <a class="reference external" href="https://www.python.org/about/success">https://www.python.org/about/success</a> 查看使用了 Python 的项目列表。 阅览 <a class="reference external" href="https://www.python.org/community/workshops/">历次 Python 会议</a> 的日程纪要可以看到许多不同公司和组织所做的贡献。</p>
|
||
<p>高水准的 Python 项目包括 <a class="reference external" href="http://www.list.org">Mailman 邮件列表管理器</a> 和 <a class="reference external" href="http://www.zope.org">Zope 应用服务器</a>。 多个 Linux 发行版,其中最著名的有 <a class="reference external" href="https://www.redhat.com">Red Hat</a> 均已使用 Python 来编写部分或全部的安装程序和系统管理软件。 在内部使用 Python 的大公司包括了 Google, Yahoo 以及 Lucasfilm 等。</p>
|
||
</section>
|
||
<section id="what-new-developments-are-expected-for-python-in-the-future">
|
||
<h3><a class="toc-backref" href="#id26">在未来可以期待 Python 将有什么新进展?</a><a class="headerlink" href="#what-new-developments-are-expected-for-python-in-the-future" title="永久链接至标题">¶</a></h3>
|
||
<p>请访问 <a class="reference external" href="https://www.python.org/dev/peps/">https://www.python.org/dev/peps/</a> 查看 Python 增强提议(PEP)。 PEP 是为 Python 加入某种新特性的提议进行描述的设计文档,其中会提供简明的技术规格说明与基本原理。 可以查找标题为“Python X.Y Release Schedule”的 PEP,其中 X.Y 是某个尚未公开发布的版本。</p>
|
||
<p>新版本的开发会在 <a class="reference external" href="https://mail.python.org/mailman/listinfo/python-dev/">python-dev 邮件列表</a> 中进行讨论。</p>
|
||
</section>
|
||
<section id="is-it-reasonable-to-propose-incompatible-changes-to-python">
|
||
<h3><a class="toc-backref" href="#id27">提议对 Python 加入不兼容的更改是否合理?</a><a class="headerlink" href="#is-it-reasonable-to-propose-incompatible-changes-to-python" title="永久链接至标题">¶</a></h3>
|
||
<p>通常来说是不合理的。 世界上已存在的 Python 代码数以亿计,因此,任何对该语言的更改即便仅会使得现有程序中极少的一部分失效也是难以令人接受的。 就算你可以提供一个转换程序,也仍然存在需要更新全部文档的问题;另外还有大量已出版的 Python 书籍,我们不希望让它们在一瞬间全部变成废纸。</p>
|
||
<p>如果必须更改某个特性,则应该提供渐进式的升级路径。 <span class="target" id="index-8"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0005"><strong>PEP 5</strong></a> 描述了引入向后不兼容的更改所需遵循的流程,以尽可能减少对用户的干扰。</p>
|
||
</section>
|
||
<section id="is-python-a-good-language-for-beginning-programmers">
|
||
<h3><a class="toc-backref" href="#id28">Python 是一种对编程初学者友好的语言吗?</a><a class="headerlink" href="#is-python-a-good-language-for-beginning-programmers" title="永久链接至标题">¶</a></h3>
|
||
<p>是的。</p>
|
||
<p>从过程式、静态类型的编程语言例如 Pascal, C 或者 C++ 以及 Java 的某一子集开始引导学生入门仍然是常见的做法。 但以 Python 作为第一种编程语言进行学习对学生可能更有利。Python 具有非常简单和一致的语法和庞大的标准库,而且最重要的是,在编程入门教学中使用 Python 可以让学生专注于更重要的编程技能,例如问题分解与数据类型设计。 使用 Python,可以快速向学生介绍基本概念例如循环与过程等。 他们甚至有可能在第一次课里就开始接触用户自定义对象。</p>
|
||
<p>对于之前从未接触过编程的学生来说,使用静态类型语言会感觉不够自然。 这会给学生带来必须掌握的额外复杂性,并减慢教学的进度。 学生需要尝试像计算机一样思考,分解问题,设计一致的接口并封装数据。 虽然从长远来看,学习和使用一种静态类型语言是很重要的,但这并不是最适宜在学生的第一次编程课上就进行探讨的主题。</p>
|
||
<p>还有许多其他方面的特点使得 Python 成为很好的入门语言。 像 Java 一样,Python 拥有一个庞大的标准库,因此可以在课程非常早期的阶段就给学生布置一些 <em>实用</em> 的编程项目。 编程作业不必仅限于标准四则运算和账目检查程序。 通过使用标准库,学生可以在学习编程基础知识的同时开发真正的应用,从而获得更大的满足感。 使用标准库还能使学生了解代码重用的概念。 而像 PyGame 这样的第三方模块同样有助于扩大学生的接触领域。</p>
|
||
<p>Python 的解释器使学生能够在编程时测试语言特性。 他们可以在一个窗口中输入程序源代码的同时开启一个解释器运行窗口。 如果他们不记得列表有哪些方法,他们这以这样做:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">L</span> <span class="o">=</span> <span class="p">[]</span>
|
||
<span class="gp">>>> </span><span class="nb">dir</span><span class="p">(</span><span class="n">L</span><span class="p">)</span>
|
||
<span class="go">['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',</span>
|
||
<span class="go">'__dir__', '__doc__', '__eq__', '__format__', '__ge__',</span>
|
||
<span class="go">'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',</span>
|
||
<span class="go">'__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__',</span>
|
||
<span class="go">'__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',</span>
|
||
<span class="go">'__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__',</span>
|
||
<span class="go">'__sizeof__', '__str__', '__subclasshook__', 'append', 'clear',</span>
|
||
<span class="go">'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',</span>
|
||
<span class="go">'reverse', 'sort']</span>
|
||
<span class="gp">>>> </span><span class="p">[</span><span class="n">d</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="nb">dir</span><span class="p">(</span><span class="n">L</span><span class="p">)</span> <span class="k">if</span> <span class="s1">'__'</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">d</span><span class="p">]</span>
|
||
<span class="go">['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']</span>
|
||
|
||
<span class="gp">>>> </span><span class="n">help</span><span class="p">(</span><span class="n">L</span><span class="o">.</span><span class="n">append</span><span class="p">)</span>
|
||
<span class="go">Help on built-in function append:</span>
|
||
|
||
<span class="go">append(...)</span>
|
||
<span class="go"> L.append(object) -> None -- append object to end</span>
|
||
|
||
<span class="gp">>>> </span><span class="n">L</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
|
||
<span class="gp">>>> </span><span class="n">L</span>
|
||
<span class="go">[1]</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>通过使用解释器,学生编写程序时参考文档总是能伴随在他们身边。</p>
|
||
<p>Python 还拥有很好的 IDE。 IDLE 是一个跨平台的 Python IDE,它基于 Tkinter 库,使用 Python 语言编写。 PythonWin 是一个 Windows 专属的 IDE。 Emacs 用户将高兴地了解到 Emacs 具有非常好的 Python 模式。 所有这些编程环境都提供语法高亮,自动缩进以及在编写代码时使用交互式解释器等功能。 请访问 <a class="reference external" href="https://wiki.python.org/moin/PythonEditors">Python wiki</a> 查看 Python 编程环境的完整列表。</p>
|
||
<p>如果你想要讨论 Python 在教育中的使用,你可能会有兴趣加入 <a class="reference external" href="https://www.python.org/community/sigs/current/edu-sig">edu-sig 邮件列表</a>。</p>
|
||
</section>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<h3><a href="../contents.html">目录</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Python常见问题</a><ul>
|
||
<li><a class="reference internal" href="#general-information">一般信息</a></li>
|
||
<li><a class="reference internal" href="#python-in-the-real-world">现实世界中的 Python</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<h4>上一个主题</h4>
|
||
<p class="topless"><a href="index.html"
|
||
title="上一章">Python 常见问题</a></p>
|
||
<h4>下一个主题</h4>
|
||
<p class="topless"><a href="programming.html"
|
||
title="下一章">编程常见问题</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<h3>本页</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../bugs.html">报告 Bug</a></li>
|
||
<li>
|
||
<a href="https://github.com/python/cpython/blob/3.8/Doc/faq/general.rst"
|
||
rel="nofollow">显示源代码
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>导航</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="总目录"
|
||
>索引</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python 模块索引"
|
||
>模块</a> |</li>
|
||
<li class="right" >
|
||
<a href="programming.html" title="编程常见问题"
|
||
>下一页</a> |</li>
|
||
<li class="right" >
|
||
<a href="index.html" title="Python 常见问题"
|
||
>上一页</a> |</li>
|
||
|
||
<li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||
<li class="switchers">
|
||
<div class="language_switcher_placeholder"></div>
|
||
<div class="version_switcher_placeholder"></div>
|
||
</li>
|
||
<li>
|
||
|
||
</li>
|
||
<li id="cpython-language-and-version">
|
||
<a href="../index.html">3.8.20 Documentation</a> »
|
||
</li>
|
||
|
||
<li class="nav-item nav-item-1"><a href="index.html" >Python 常见问题</a> »</li>
|
||
<li class="right">
|
||
|
||
|
||
<div class="inline-search" role="search">
|
||
<form class="inline-search" action="../search.html" method="get">
|
||
<input placeholder="快速搜索" aria-label="快速搜索" type="text" name="q" />
|
||
<input type="submit" value="转向" />
|
||
<input type="hidden" name="check_keywords" value="yes" />
|
||
<input type="hidden" name="area" value="default" />
|
||
</form>
|
||
</div>
|
||
|
|
||
</li>
|
||
|
||
</ul>
|
||
</div>
|
||
<div class="footer">
|
||
© <a href="../copyright.html">版权所有</a> 2001-2024, Python Software Foundation.
|
||
<br />
|
||
This page is licensed under the Python Software Foundation License Version 2.
|
||
<br />
|
||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
||
<br />
|
||
|
||
<br />
|
||
|
||
The Python Software Foundation is a non-profit corporation.
|
||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
||
<br />
|
||
<br />
|
||
|
||
最后更新于 12月 09, 2024.
|
||
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
|
||
<br />
|
||
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 2.4.4.
|
||
</div>
|
||
|
||
</body>
|
||
</html> |