Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d66b5051
Commit
d66b5051
authored
Jan 14, 2012
by
Gregory P. Smith
Browse files
Options
Browse Files
Download
Plain Diff
merge heads
parents
5831bd2f
ee090c71
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1 addition
and
1730 deletions
+1
-1730
Doc/contents.rst
Doc/contents.rst
+0
-1
Doc/documenting/building.rst
Doc/documenting/building.rst
+0
-92
Doc/documenting/fromlatex.rst
Doc/documenting/fromlatex.rst
+0
-202
Doc/documenting/index.rst
Doc/documenting/index.rst
+0
-38
Doc/documenting/intro.rst
Doc/documenting/intro.rst
+0
-29
Doc/documenting/markup.rst
Doc/documenting/markup.rst
+0
-904
Doc/documenting/rest.rst
Doc/documenting/rest.rst
+0
-243
Doc/documenting/style.rst
Doc/documenting/style.rst
+0
-218
Doc/tools/sphinxext/indexcontent.html
Doc/tools/sphinxext/indexcontent.html
+0
-2
Doc/whatsnew/2.6.rst
Doc/whatsnew/2.6.rst
+1
-1
No files found.
Doc/contents.rst
View file @
d66b5051
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
c-api/index.rst
c-api/index.rst
packaging/index.rst
packaging/index.rst
install/index.rst
install/index.rst
documenting/index.rst
howto/index.rst
howto/index.rst
faq/index.rst
faq/index.rst
glossary.rst
glossary.rst
...
...
Doc/documenting/building.rst
deleted
100644 → 0
View file @
5831bd2f
Building the documentation
==========================
You need to have Python 2.4 or higher installed; the toolset used to build the
docs is written in Python. It is called *Sphinx*, it is not included in this
tree, but maintained separately. Also needed are the docutils, supplying the
base markup that Sphinx uses, Jinja, a templating engine, and optionally
Pygments, a code highlighter.
Using make
----------
Luckily, a Makefile has been prepared so that on Unix, provided you have
installed Python and Subversion, you can just run ::
cd Doc
make html
to check out the necessary toolset in the :file:`tools/` subdirectory and build
the HTML output files. To view the generated HTML, point your favorite browser
at the top-level index :file:`build/html/index.html` after running "make".
Available make targets are:
* "html", which builds standalone HTML files for offline viewing.
* "htmlhelp", which builds HTML files and a HTML Help project file usable to
convert them into a single Compiled HTML (.chm) file -- these are popular
under Microsoft Windows, but very handy on every platform.
To create the CHM file, you need to run the Microsoft HTML Help Workshop
over the generated project (.hhp) file.
* "latex", which builds LaTeX source files as input to "pdflatex" to produce
PDF documents.
* "text", which builds a plain text file for each source file.
* "linkcheck", which checks all external references to see whether they are
broken, redirected or malformed, and outputs this information to stdout
as well as a plain-text (.txt) file.
* "changes", which builds an overview over all versionadded/versionchanged/
deprecated items in the current version. This is meant as a help for the
writer of the "What's New" document.
* "coverage", which builds a coverage overview for standard library modules
and C API.
* "pydoc-topics", which builds a Python module containing a dictionary with
plain text documentation for the labels defined in
:file:`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and
keyword help.
A "make update" updates the Subversion checkouts in :file:`tools/`.
Without make
------------
You'll need to install the Sphinx package, either by checking it out via ::
svn co http://svn.python.org/projects/external/Sphinx-0.6.5/sphinx tools/sphinx
or by installing it from PyPI.
Then, you need to install Docutils, either by checking it out via ::
svn co http://svn.python.org/projects/external/docutils-0.6/docutils tools/docutils
or by installing it from http://docutils.sf.net/.
You also need Jinja2, either by checking it out via ::
svn co http://svn.python.org/projects/external/Jinja-2.3.1/jinja2 tools/jinja2
or by installing it from PyPI.
You can optionally also install Pygments, either as a checkout via ::
svn co http://svn.python.org/projects/external/Pygments-1.3.1/pygments tools/pygments
or from PyPI at http://pypi.python.org/pypi/Pygments.
Then, make an output directory, e.g. under `build/`, and run ::
python tools/sphinx-build.py -b<builder> . build/<outputdirectory>
where `<builder>` is one of html, text, latex, or htmlhelp (for explanations see
the make targets above).
Doc/documenting/fromlatex.rst
deleted
100644 → 0
View file @
5831bd2f
.. highlightlang:: rest
Differences to the LaTeX markup
===============================
Though the markup language is different, most of the concepts and markup types
of the old LaTeX docs have been kept -- environments as reST directives, inline
commands as reST roles and so forth.
However, there are some differences in the way these work, partly due to the
differences in the markup languages, partly due to improvements in Sphinx. This
section lists these differences, in order to give those familiar with the old
format a quick overview of what they might run into.
Inline markup
-------------
These changes have been made to inline markup:
* **Cross-reference roles**
Most of the following semantic roles existed previously as inline commands,
but didn't do anything except formatting the content as code. Now, they
cross-reference to known targets (some names have also been shortened):
| *mod* (previously *refmodule* or *module*)
| *func* (previously *function*)
| *data* (new)
| *const*
| *class*
| *meth* (previously *method*)
| *attr* (previously *member*)
| *exc* (previously *exception*)
| *cdata*
| *cfunc* (previously *cfunction*)
| *cmacro* (previously *csimplemacro*)
| *ctype*
Also different is the handling of *func* and *meth*: while previously
parentheses were added to the callable name (like ``\func{str()}``), they are
now appended by the build system -- appending them in the source will result
in double parentheses. This also means that ``:func:`str(object)``` will not
work as expected -- use ````str(object)```` instead!
* **Inline commands implemented as directives**
These were inline commands in LaTeX, but are now directives in reST:
| *deprecated*
| *versionadded*
| *versionchanged*
These are used like so::
.. deprecated:: 2.5
Reason of deprecation.
Also, no period is appended to the text for *versionadded* and
*versionchanged*.
| *note*
| *warning*
These are used like so::
.. note::
Content of note.
* **Otherwise changed commands**
The *samp* command previously formatted code and added quotation marks around
it. The *samp* role, however, features a new highlighting system just like
*file* does:
``:samp:`open({filename}, {mode})``` results in :samp:`open({filename}, {mode})`
* **Dropped commands**
These were commands in LaTeX, but are not available as roles:
| *bfcode*
| *character* (use :samp:`\`\`'c'\`\``)
| *citetitle* (use ```Title <URL>`_``)
| *code* (use ````code````)
| *email* (just write the address in body text)
| *filenq*
| *filevar* (use the ``{...}`` highlighting feature of *file*)
| *programopt*, *longprogramopt* (use *option*)
| *ulink* (use ```Title <URL>`_``)
| *url* (just write the URL in body text)
| *var* (use ``*var*``)
| *infinity*, *plusminus* (use the Unicode character)
| *shortversion*, *version* (use the ``|version|`` and ``|release|`` substitutions)
| *emph*, *strong* (use the reST markup)
* **Backslash escaping**
In reST, a backslash must be escaped in normal text, and in the content of
roles. However, in code literals and literal blocks, it must not be escaped.
Example: ``:file:`C:\\Temp\\my.tmp``` vs. ````open("C:\Temp\my.tmp")````.
Information units
-----------------
Information units (*...desc* environments) have been made reST directives.
These changes to information units should be noted:
* **New names**
"desc" has been removed from every name. Additionally, these directives have
new names:
| *cfunction* (previously *cfuncdesc*)
| *cmacro* (previously *csimplemacrodesc*)
| *exception* (previously *excdesc*)
| *function* (previously *funcdesc*)
| *attribute* (previously *memberdesc*)
The *classdesc\** and *excclassdesc* environments have been dropped, the
*class* and *exception* directives support classes documented with and without
constructor arguments.
* **Multiple objects**
The equivalent of the *...line* commands is::
.. function:: do_foo(bar)
do_bar(baz)
Description of the functions.
IOW, just give one signatures per line, at the same indentation level.
* **Arguments**
There is no *optional* command. Just give function signatures like they
should appear in the output::
.. function:: open(filename[, mode[, buffering]])
Description.
Note: markup in the signature is not supported.
* **Indexing**
The *...descni* environments have been dropped. To mark an information unit
as unsuitable for index entry generation, use the *noindex* option like so::
.. function:: foo_*
:noindex:
Description.
* **New information units**
There are new generic information units: One is called "describe" and can be
used to document things that are not covered by the other units::
.. describe:: a == b
The equals operator.
The others are::
.. cmdoption:: -O
Describes a command-line option.
.. envvar:: PYTHONINSPECT
Describes an environment variable.
Structure
---------
The LaTeX docs were split in several toplevel manuals. Now, all files are part
of the same documentation tree, as indicated by the *toctree* directives in the
sources (though individual output formats may choose to split them up into parts
again). Every *toctree* directive embeds other files as subdocuments of the
current file (this structure is not necessarily mirrored in the filesystem
layout). The toplevel file is :file:`contents.rst`.
However, most of the old directory structure has been kept, with the
directories renamed as follows:
* :file:`api` -> :file:`c-api`
* :file:`dist` -> :file:`distutils`, with the single TeX file split up
* :file:`doc` -> :file:`documenting`
* :file:`ext` -> :file:`extending`
* :file:`inst` -> :file:`installing`
* :file:`lib` -> :file:`library`
* :file:`mac` -> merged into :file:`library`, with :file:`mac/using.tex`
moved to :file:`using/mac.rst`
* :file:`ref` -> :file:`reference`
* :file:`tut` -> :file:`tutorial`, with the single TeX file split up
.. XXX more (index-generating, production lists, ...)
Doc/documenting/index.rst
deleted
100644 → 0
View file @
5831bd2f
.. _documenting-index:
######################
Documenting Python
######################
The Python language has a substantial body of documentation, much of it
contributed by various authors. The markup used for the Python documentation is
`reStructuredText`_, developed by the `docutils`_ project, amended by custom
directives and using a toolset named `Sphinx`_ to postprocess the HTML output.
This document describes the style guide for our documentation as well as the
custom reStructuredText markup introduced by Sphinx to support Python
documentation and how it should be used.
.. _reStructuredText: http://docutils.sf.net/rst.html
.. _docutils: http://docutils.sf.net/
.. _Sphinx: http://sphinx.pocoo.org/
.. note::
If you're interested in contributing to Python's documentation, there's no
need to write reStructuredText if you're not so inclined; plain text
contributions are more than welcome as well. Send an e-mail to
docs@python.org or open an issue on the :ref:`tracker <reporting-bugs>`.
.. toctree::
:numbered:
:maxdepth: 1
intro.rst
style.rst
rest.rst
markup.rst
fromlatex.rst
building.rst
Doc/documenting/intro.rst
deleted
100644 → 0
View file @
5831bd2f
Introduction
============
Python's documentation has long been considered to be good for a free
programming language. There are a number of reasons for this, the most
important being the early commitment of Python's creator, Guido van Rossum, to
providing documentation on the language and its libraries, and the continuing
involvement of the user community in providing assistance for creating and
maintaining documentation.
The involvement of the community takes many forms, from authoring to bug reports
to just plain complaining when the documentation could be more complete or
easier to use.
This document is aimed at authors and potential authors of documentation for
Python. More specifically, it is for people contributing to the standard
documentation and developing additional documents using the same tools as the
standard documents. This guide will be less useful for authors using the Python
documentation tools for topics other than Python, and less useful still for
authors not using the tools at all.
If your interest is in contributing to the Python documentation, but you don't
have the time or inclination to learn reStructuredText and the markup structures
documented here, there's a welcoming place for you among the Python contributors
as well. Any time you feel that you can clarify existing documentation or
provide documentation that's missing, the existing documentation team will
gladly work with you to integrate your text, dealing with the markup for you.
Please don't let the material in this document stand between the documentation
and your desire to help out!
\ No newline at end of file
Doc/documenting/markup.rst
deleted
100644 → 0
View file @
5831bd2f
This diff is collapsed.
Click to expand it.
Doc/documenting/rest.rst
deleted
100644 → 0
View file @
5831bd2f
.. highlightlang:: rest
reStructuredText Primer
=======================
This section is a brief introduction to reStructuredText (reST) concepts and
syntax, intended to provide authors with enough information to author documents
productively. Since reST was designed to be a simple, unobtrusive markup
language, this will not take too long.
.. seealso::
The authoritative `reStructuredText User
Documentation <http://docutils.sourceforge.net/rst.html>`_.
Paragraphs
----------
The paragraph is the most basic block in a reST document. Paragraphs are simply
chunks of text separated by one or more blank lines. As in Python, indentation
is significant in reST, so all lines of the same paragraph must be left-aligned
to the same level of indentation.
Inline markup
-------------
The standard reST inline markup is quite simple: use
* one asterisk: ``*text*`` for emphasis (italics),
* two asterisks: ``**text**`` for strong emphasis (boldface), and
* backquotes: ````text```` for code samples.
If asterisks or backquotes appear in running text and could be confused with
inline markup delimiters, they have to be escaped with a backslash.
Be aware of some restrictions of this markup:
* it may not be nested,
* content may not start or end with whitespace: ``* text*`` is wrong,
* it must be separated from surrounding text by non-word characters. Use a
backslash escaped space to work around that: ``thisis\ *one*\ word``.
These restrictions may be lifted in future versions of the docutils.
reST also allows for custom "interpreted text roles"', which signify that the
enclosed text should be interpreted in a specific way. Sphinx uses this to
provide semantic markup and cross-referencing of identifiers, as described in
the appropriate section. The general syntax is ``:rolename:`content```.
Lists and Quotes
----------------
List markup is natural: just place an asterisk at the start of a paragraph and
indent properly. The same goes for numbered lists; they can also be
autonumbered using a ``#`` sign::
* This is a bulleted list.
* It has two items, the second
item uses two lines.
1. This is a numbered list.
2. It has two items too.
#. This is a numbered list.
#. It has two items too.
Nested lists are possible, but be aware that they must be separated from the
parent list items by blank lines::
* this is
* a list
* with a nested list
* and some subitems
* and here the parent list continues
Definition lists are created as follows::
term (up to a line of text)
Definition of the term, which must be indented
and can even consist of multiple paragraphs
next term
Description.
Paragraphs are quoted by just indenting them more than the surrounding
paragraphs.
Source Code
-----------
Literal code blocks are introduced by ending a paragraph with the special marker
``::``. The literal block must be indented::
This is a normal text paragraph. The next paragraph is a code sample::
It is not processed in any way, except
that the indentation is removed.
It can span multiple lines.
This is a normal text paragraph again.
The handling of the ``::`` marker is smart:
* If it occurs as a paragraph of its own, that paragraph is completely left
out of the document.
* If it is preceded by whitespace, the marker is removed.
* If it is preceded by non-whitespace, the marker is replaced by a single
colon.
That way, the second sentence in the above example's first paragraph would be
rendered as "The next paragraph is a code sample:".
Hyperlinks
----------
External links
^^^^^^^^^^^^^^
Use ```Link text <http://target>`_`` for inline web links. If the link text
should be the web address, you don't need special markup at all, the parser
finds links and mail addresses in ordinary text.
Internal links
^^^^^^^^^^^^^^
Internal linking is done via a special reST role, see the section on specific
markup, :ref:`doc-ref-role`.
Sections
--------
Section headers are created by underlining (and optionally overlining) the
section title with a punctuation character, at least as long as the text::
=================
This is a heading
=================
Normally, there are no heading levels assigned to certain characters as the
structure is determined from the succession of headings. However, for the
Python documentation, we use this convention:
* ``#`` with overline, for parts
* ``*`` with overline, for chapters
* ``=``, for sections
* ``-``, for subsections
* ``^``, for subsubsections
* ``"``, for paragraphs
Explicit Markup
---------------
"Explicit markup" is used in reST for most constructs that need special
handling, such as footnotes, specially-highlighted paragraphs, comments, and
generic directives.
An explicit markup block begins with a line starting with ``..`` followed by
whitespace and is terminated by the next paragraph at the same level of
indentation. (There needs to be a blank line between explicit markup and normal
paragraphs. This may all sound a bit complicated, but it is intuitive enough
when you write it.)
Directives
----------
A directive is a generic block of explicit markup. Besides roles, it is one of
the extension mechanisms of reST, and Sphinx makes heavy use of it.
Basically, a directive consists of a name, arguments, options and content. (Keep
this terminology in mind, it is used in the next chapter describing custom
directives.) Looking at this example, ::
.. function:: foo(x)
foo(y, z)
:bar: no
Return a line of text input from the user.
``function`` is the directive name. It is given two arguments here, the
remainder of the first line and the second line, as well as one option ``bar``
(as you can see, options are given in the lines immediately following the
arguments and indicated by the colons).
The directive content follows after a blank line and is indented relative to the
directive start.
Footnotes
---------
For footnotes, use ``[#]_`` to mark the footnote location, and add the footnote
body at the bottom of the document after a "Footnotes" rubric heading, like so::
Lorem ipsum [#]_ dolor sit amet ... [#]_
.. rubric:: Footnotes
.. [#] Text of the first footnote.
.. [#] Text of the second footnote.
You can also explicitly number the footnotes for better context.
Comments
--------
Every explicit markup block which isn't a valid markup construct (like the
footnotes above) is regarded as a comment.
Source encoding
---------------
Since the easiest way to include special characters like em dashes or copyright
signs in reST is to directly write them as Unicode characters, one has to
specify an encoding:
All Python documentation source files must be in UTF-8 encoding, and the HTML
documents written from them will be in that encoding as well.
Gotchas
-------
There are some problems one commonly runs into while authoring reST documents:
* **Separation of inline markup:** As said above, inline markup spans must be
separated from the surrounding text by non-word characters, you have to use
an escaped space to get around that.
Doc/documenting/style.rst
deleted
100644 → 0
View file @
5831bd2f
..
highlightlang
::
rest
Style
guide
===========
The
Python
documentation
should
follow
the
`
Apple
Publications
Style
Guide
`
_
wherever
possible
.
This
particular
style
guide
was
selected
mostly
because
it
seems
reasonable
and
is
easy
to
get
online
.
Topics
which
are
either
not
covered
in
Apple
's style guide or treated
differently in Python documentation will be discussed in this
document.
Use of whitespace
-----------------
All reST files use an indentation of 3 spaces; no tabs are allowed. The
maximum line length is 80 characters for normal text, but tables, deeply
indented code samples and long links may extend beyond that. Code example
bodies should use normal Python 4-space indentation.
Make generous use of blank lines where applicable; they help grouping things
together.
A sentence-ending period may be followed by one or two spaces; while reST
ignores the second space, it is customarily put in by some users, for example
to aid Emacs'
auto
-
fill
mode
.
Footnotes
---------
Footnotes
are
generally
discouraged
,
though
they
may
be
used
when
they
are
the
best
way
to
present
specific
information
.
When
a
footnote
reference
is
added
at
the
end
of
the
sentence
,
it
should
follow
the
sentence
-
ending
punctuation
.
The
reST
markup
should
appear
something
like
this
::
This
sentence
has
a
footnote
reference
.
[#]
_
This
is
the
next
sentence
.
Footnotes
should
be
gathered
at
the
end
of
a
file
,
or
if
the
file
is
very
long
,
at
the
end
of
a
section
.
The
docutils
will
automatically
create
backlinks
to
the
footnote
reference
.
Footnotes
may
appear
in
the
middle
of
sentences
where
appropriate
.
Capitalization
--------------
..
sidebar
::
Sentence
case
Sentence
case
is
a
set
of
capitalization
rules
used
in
English
sentences
:
the
first
word
is
always
capitalized
and
other
words
are
only
capitalized
if
there
is
a
specific
rule
requiring
it
.
Apple
style
guide
recommends
the
use
of
title
case
in
section
titles
.
However
,
rules
for
which
words
should
be
capitalized
in
title
case
vary
greaty
between
publications
.
In
Python
documentation
,
use
of
sentence
case
in
section
titles
is
preferable
,
but
consistency
within
a
unit
is
more
important
than
following
this
rule
.
If
you
add
a
section
to
the
chapter
where
most
sections
are
in
title
case
you
can
either
convert
all
titles
to
sentence
case
or
use
the
dominant
style
in
the
new
section
title
.
Sentences
that
start
with
a
word
for
which
specific
rules
require
starting
it
with
a
lower
case
letter
should
be
avoided
in
titles
and
elsewhere
.
..
note
::
Sections
that
describe
a
library
module
often
have
titles
in
the
form
of
"modulename --- Short description of the module."
In
this
case
,
the
description
should
be
capitalized
as
a
stand
-
alone
sentence
.
Many
special
names
are
used
in
the
Python
documentation
,
including
the
names
of
operating
systems
,
programming
languages
,
standards
bodies
,
and
the
like
.
Most
of
these
entities
are
not
assigned
any
special
markup
,
but
the
preferred
spellings
are
given
here
to
aid
authors
in
maintaining
the
consistency
of
presentation
in
the
Python
documentation
.
Other
terms
and
words
deserve
special
mention
as
well
;
these
conventions
should
be
used
to
ensure
consistency
throughout
the
documentation
:
CPU
For
"central processing unit."
Many
style
guides
say
this
should
be
spelled
out
on
the
first
use
(
and
if
you
must
use
it
,
do
so
!). For
the
Python
documentation
,
this
abbreviation
should
be
avoided
since
there
's no reasonable way to predict which occurrence will be the
first seen by the reader. It is better to use the word "processor"
instead.
POSIX
The name assigned to a particular group of standards. This is always
uppercase.
Python
The name of our favorite programming language is always capitalized.
reST
For "reStructuredText," an easy to read, plaintext markup syntax
used to produce Python documentation. When spelled out, it is
always one word and both forms start with a lower case '
r
'.
Unicode
The name of a character coding system. This is always written
capitalized.
Unix
The name of the operating system developed at AT&T Bell Labs in the early
1970s.
Affirmative Tone
----------------
The documentation focuses on affirmatively stating what the language does and
how to use it effectively.
Except for certain security risks or segfault risks, the docs should avoid
wording along the lines of "feature x is dangerous" or "experts only". These
kinds of value judgments belong in external blogs and wikis, not in the core
documentation.
Bad example (creating worry in the mind of a reader):
Warning: failing to explicitly close a file could result in lost data or
excessive resource consumption. Never rely on reference counting to
automatically close a file.
Good example (establishing confident knowledge in the effective use of the language):
A best practice for using files is use a try/finally pair to explicitly
close a file after it is used. Alternatively, using a with-statement can
achieve the same effect. This assures that files are flushed and file
descriptor resources are released in a timely manner.
Economy of Expression
---------------------
More documentation is not necessarily better documentation. Err on the side
of being succinct.
It is an unfortunate fact that making documentation longer can be an impediment
to understanding and can result in even more ways to misread or misinterpret the
text. Long descriptions full of corner cases and caveats can create the
impression that a function is more complex or harder to use than it actually is.
The documentation for :func:`super` is an example of where a good deal of
information was condensed into a few short paragraphs. Discussion of
:func:`super` could have filled a chapter in a book, but it is often easier to
grasp a terse description than a lengthy narrative.
Code Examples
-------------
Short code examples can be a useful adjunct to understanding. Readers can often
grasp a simple example more quickly than they can digest a formal description in
prose.
People learn faster with concrete, motivating examples that match the context of
a typical use case. For instance, the :func:`str.rpartition` method is better
demonstrated with an example splitting the domain from a URL than it would be
with an example of removing the last word from a line of Monty Python dialog.
The ellipsis for the :attr:`sys.ps2` secondary interpreter prompt should only be
used sparingly, where it is necessary to clearly differentiate between input
lines and output lines. Besides contributing visual clutter, it makes it
difficult for readers to cut-and-paste examples so they can experiment with
variations.
Code Equivalents
----------------
Giving pure Python code equivalents (or approximate equivalents) can be a useful
adjunct to a prose description. A documenter should carefully weigh whether the
code equivalent adds value.
A good example is the code equivalent for :func:`all`. The short 4-line code
equivalent is easily digested; it re-emphasizes the early-out behavior; and it
clarifies the handling of the corner-case where the iterable is empty. In
addition, it serves as a model for people wanting to implement a commonly
requested alternative where :func:`all` would return the specific object
evaluating to False whenever the function terminates early.
A more questionable example is the code for :func:`itertools.groupby`. Its code
equivalent borders on being too complex to be a quick aid to understanding.
Despite its complexity, the code equivalent was kept because it serves as a
model to alternative implementations and because the operation of the "grouper"
is more easily shown in code than in English prose.
An example of when not to use a code equivalent is for the :func:`oct` function.
The exact steps in converting a number to octal doesn'
t
add
value
for
a
user
trying
to
learn
what
the
function
does
.
Audience
--------
The
tone
of
the
tutorial
(
and
all
the
docs
)
needs
to
be
respectful
of
the
reader
's intelligence. Don'
t
presume
that
the
readers
are
stupid
.
Lay
out
the
relevant
information
,
show
motivating
use
cases
,
provide
glossary
links
,
and
do
your
best
to
connect
-
the
-
dots
,
but
don
't talk down to them or waste their time.
The tutorial is meant for newcomers, many of whom will be using the tutorial to
evaluate the language as a whole. The experience needs to be positive and not
leave the reader with worries that something bad will happen if they make a
misstep. The tutorial serves as guide for intelligent and curious readers,
saving details for the how-to guides and other sources.
Be careful accepting requests for documentation changes from the rare but vocal
category of reader who is looking for vindication for one of their programming
errors ("I made a mistake, therefore the docs must be wrong ..."). Typically,
the documentation wasn'
t
consulted
until
after
the
error
was
made
.
It
is
unfortunate
,
but
typically
no
documentation
edit
would
have
saved
the
user
from
making
false
assumptions
about
the
language
(
"I was surprised by ..."
).
..
_Apple
Publications
Style
Guide
:
http
://
developer
.
apple
.
com
/
mac
/
library
/
documentation
/
UserExperience
/
Conceptual
/
APStyleGuide
/
APSG_2009
.
pdf
Doc/tools/sphinxext/indexcontent.html
View file @
d66b5051
...
@@ -24,8 +24,6 @@
...
@@ -24,8 +24,6 @@
<span
class=
"linkdescr"
>
finding and installing modules and applications
</span></p>
<span
class=
"linkdescr"
>
finding and installing modules and applications
</span></p>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
packaging
/
index
")
}}"
>
Distributing Python Projects
</a><br/>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
packaging
/
index
")
}}"
>
Distributing Python Projects
</a><br/>
<span
class=
"linkdescr"
>
packaging and distributing modules and applications
</span></p>
<span
class=
"linkdescr"
>
packaging and distributing modules and applications
</span></p>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
documenting
/
index
")
}}"
>
Documenting Python
</a><br/>
<span
class=
"linkdescr"
>
guide for documentation authors
</span></p>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
faq
/
index
")
}}"
>
FAQs
</a><br/>
<p
class=
"biglink"
><a
class=
"biglink"
href=
"{{ pathto("
faq
/
index
")
}}"
>
FAQs
</a><br/>
<span
class=
"linkdescr"
>
frequently asked questions (with answers!)
</span></p>
<span
class=
"linkdescr"
>
frequently asked questions (with answers!)
</span></p>
</td></tr>
</td></tr>
...
...
Doc/whatsnew/2.6.rst
View file @
d66b5051
...
@@ -234,7 +234,7 @@ have adopted Sphinx as their documentation tool.
...
@@ -234,7 +234,7 @@ have adopted Sphinx as their documentation tool.
.. seealso::
.. seealso::
:ref:`documenting-index`
`Documenting Python <http://docs.python.org/devguide/documenting.html>`__
Describes how to write for Python'
s
documentation
.
Describes how to write for Python'
s
documentation
.
`
Sphinx
<
http
://
sphinx
.
pocoo
.
org
/>`
__
`
Sphinx
<
http
://
sphinx
.
pocoo
.
org
/>`
__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment