summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-01 21:48:47 (GMT)
committerGeorg Brandl <georg@python.org>2010-08-01 21:48:47 (GMT)
commit6290bcfc2552b03a4d36ffd773d152d0cfb8a571 (patch)
treef76230792346553e1ad14b7b08118ad7dd4a76c2 /Doc
parenta228ad6ff1ec991284ea92526938185829a464be (diff)
downloadcpython-6290bcfc2552b03a4d36ffd773d152d0cfb8a571.zip
cpython-6290bcfc2552b03a4d36ffd773d152d0cfb8a571.tar.gz
cpython-6290bcfc2552b03a4d36ffd773d152d0cfb8a571.tar.bz2
Merged revisions 83452,83457,83466,83471,83475,83480,83486 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint ................ r83452 | georg.brandl | 2010-08-01 23:06:46 +0200 (So, 01 Aug 2010) | 25 lines Merged revisions 83226-83227,83229-83230,83232 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83226 | georg.brandl | 2010-07-29 16:17:12 +0200 (Do, 29 Jul 2010) | 1 line #1090076: explain the behavior of *vars* in get() better. ........ r83227 | georg.brandl | 2010-07-29 16:23:06 +0200 (Do, 29 Jul 2010) | 1 line Use Py_CLEAR(). ........ r83229 | georg.brandl | 2010-07-29 16:32:22 +0200 (Do, 29 Jul 2010) | 1 line #9407: document configparser.Error. ........ r83230 | georg.brandl | 2010-07-29 16:36:11 +0200 (Do, 29 Jul 2010) | 1 line Use correct directive and name. ........ r83232 | georg.brandl | 2010-07-29 16:49:08 +0200 (Do, 29 Jul 2010) | 1 line #9388: remove ERA_YEAR which is never defined in the source code. ........ ................ r83457 | georg.brandl | 2010-08-01 23:10:57 +0200 (So, 01 Aug 2010) | 9 lines Merged revisions 83223 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83223 | georg.brandl | 2010-07-29 15:38:37 +0200 (Do, 29 Jul 2010) | 1 line #3874: document HTMLParser.unknown_decl(). ........ ................ r83466 | georg.brandl | 2010-08-01 23:23:50 +0200 (So, 01 Aug 2010) | 29 lines Merged revisions 83160-83161,83166,83168-83169,83171 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83160 | georg.brandl | 2010-07-26 10:51:42 +0200 (Mo, 26 Jul 2010) | 1 line #9381: fix markup. ........ r83161 | georg.brandl | 2010-07-26 11:33:12 +0200 (Mo, 26 Jul 2010) | 1 line Add Brian Quinlan. ........ r83166 | georg.brandl | 2010-07-26 17:11:49 +0200 (Mo, 26 Jul 2010) | 1 line Fix grammar. ........ r83168 | georg.brandl | 2010-07-26 19:00:20 +0200 (Mo, 26 Jul 2010) | 1 line Fix indentation in example. ........ r83169 | georg.brandl | 2010-07-26 19:09:32 +0200 (Mo, 26 Jul 2010) | 1 line Add Reid. ........ r83171 | georg.brandl | 2010-07-26 23:12:13 +0200 (Mo, 26 Jul 2010) | 1 line Clarify. ........ ................ r83471 | georg.brandl | 2010-08-01 23:26:45 +0200 (So, 01 Aug 2010) | 9 lines Merged revisions 83106 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83106 | georg.brandl | 2010-07-23 18:55:26 +0200 (Fr, 23 Jul 2010) | 1 line Fix some markup glitches. ........ ................ r83475 | georg.brandl | 2010-08-01 23:28:47 +0200 (So, 01 Aug 2010) | 9 lines Merged revisions 82965 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82965 | georg.brandl | 2010-07-19 13:28:05 +0200 (Mo, 19 Jul 2010) | 1 line Clarification. Yay importlib! ........ ................ r83480 | georg.brandl | 2010-08-01 23:33:42 +0200 (So, 01 Aug 2010) | 17 lines Merged revisions 82871,82960-82961 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82871 | georg.brandl | 2010-07-14 10:00:22 +0200 (Mi, 14 Jul 2010) | 1 line #9258: fix copy-paste errors. ........ r82960 | georg.brandl | 2010-07-19 08:52:35 +0200 (Mo, 19 Jul 2010) | 1 line Clarify. ........ r82961 | georg.brandl | 2010-07-19 08:57:52 +0200 (Mo, 19 Jul 2010) | 1 line Clarify :option: description. ........ ................ r83486 | georg.brandl | 2010-08-01 23:44:38 +0200 (So, 01 Aug 2010) | 13 lines Merged revisions 82832,82834 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82832 | georg.brandl | 2010-07-12 11:00:29 +0200 (Mo, 12 Jul 2010) | 1 line Take care of duplicate target name warnings. ........ r82834 | georg.brandl | 2010-07-12 11:06:13 +0200 (Mo, 12 Jul 2010) | 1 line Use raw string literals for regexes containing backlash. ........ ................
Diffstat (limited to 'Doc')
-rw-r--r--Doc/documenting/markup.rst9
-rw-r--r--Doc/faq/extending.rst8
-rw-r--r--Doc/install/index.rst4
-rw-r--r--Doc/library/configparser.rst27
-rw-r--r--Doc/library/htmlparser.rst16
-rw-r--r--Doc/library/itertools.rst2
-rw-r--r--Doc/library/locale.rst4
-rw-r--r--Doc/library/re.rst4
-rw-r--r--Doc/library/select.rst6
-rw-r--r--Doc/library/urllib2.rst3
-rw-r--r--Doc/tutorial/classes.rst7
-rw-r--r--Doc/whatsnew/2.0.rst2
-rw-r--r--Doc/whatsnew/2.5.rst2
13 files changed, 60 insertions, 34 deletions
diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst
index eec8650..c6f5b74 100644
--- a/Doc/documenting/markup.rst
+++ b/Doc/documenting/markup.rst
@@ -200,8 +200,8 @@ The directives are:
.. describe:: cmdoption
- Describes a command line option or switch. Option argument names should be
- enclosed in angle brackets. Example::
+ Describes a Python command line option or switch. Option argument names
+ should be enclosed in angle brackets. Example::
.. cmdoption:: -m <module>
@@ -502,8 +502,9 @@ in a different style:
.. describe:: option
- A command-line option to an executable program. The leading hyphen(s) must
- be included.
+ A command-line option of Python. The leading hyphen(s) must be included.
+ If a matching ``cmdoption`` directive exists, it is linked to. For options
+ of other programs or scripts, use simple ````code```` markup.
.. describe:: program
diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst
index 5c716fe..be5c51c 100644
--- a/Doc/faq/extending.rst
+++ b/Doc/faq/extending.rst
@@ -26,6 +26,8 @@ function that is going to be called by the Python interpreter. Global or static
C++ objects with constructors are probably not a good idea.
+.. _c-wrapper-software:
+
Writing C is hard; are there any alternatives?
----------------------------------------------
@@ -197,11 +199,7 @@ begin by reading :ref:`the "Extending and Embedding" document
whole lot of difference between C and C++ -- so the strategy of building a new
Python type around a C structure (pointer) type will also work for C++ objects.
-For C++ libraries, you can look at `SIP
-<http://www.riverbankcomputing.co.uk/software/sip/>`_, `CXX
-<http://cxx.sourceforge.net/>`_, `Boost
-<http://www.boost.org/libs/python/doc/index.html>`_, `Weave
-<http://www.scipy.org/Weave>`_ or `SWIG <http://www.swig.org>`_
+For C++ libraries, see :ref:`c-wrapper-software`.
I added a module using the Setup file and the make fails; why?
diff --git a/Doc/install/index.rst b/Doc/install/index.rst
index 3781ad9..a5d2671 100644
--- a/Doc/install/index.rst
+++ b/Doc/install/index.rst
@@ -314,8 +314,8 @@ The idea behind the "home scheme" is that you build and maintain a personal
stash of Python modules. This scheme's name is derived from the idea of a
"home" directory on Unix, since it's not unusual for a Unix user to make their
home directory have a layout similar to :file:`/usr/` or :file:`/usr/local/`.
-This scheme can be used by anyone, regardless of the operating system their
-installing for.
+This scheme can be used by anyone, regardless of the operating system they
+are installing for.
Installing a new module distribution is as simple as ::
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst
index 878685c..867f091 100644
--- a/Doc/library/configparser.rst
+++ b/Doc/library/configparser.rst
@@ -41,6 +41,18 @@ section, or values in a special ``DEFAULT`` section. Additional defaults can be
provided on initialization and retrieval. Lines beginning with ``'#'`` or
``';'`` are ignored and may be used to provide comments.
+Configuration files may include comments, prefixed by specific characters (``#``
+and ``;``). Comments may appear on their own in an otherwise empty line, or may
+be entered in lines holding values or spection names. In the latter case, they
+need to be preceded by a whitespace character to be recognized as a comment.
+(For backwards compatibility, only ``;`` starts an inline comment, while ``#``
+does not.)
+
+On top of the core functionality, :class:`SafeConfigParser` supports
+interpolation. This means values can contain format strings which refer to
+other values in the same section, or values in a special ``DEFAULT`` section.
+Additional defaults can be provided on initialization.
+
For example::
[My Section]
@@ -104,6 +116,11 @@ write-back, as will be the keys within each section.
.. versionadded:: 2.3
+.. exception:: Error
+
+ Base class for all other configparser exceptions.
+
+
.. exception:: NoSectionError
Exception raised when a specified section is not found.
@@ -347,11 +364,13 @@ The :class:`ConfigParser` class extends some methods of the
.. method:: ConfigParser.get(section, option[, raw[, vars]])
- Get an *option* value for the named *section*. All the ``'%'`` interpolations
- are expanded in the return values, based on the defaults passed into the
- constructor, as well as the options *vars* provided, unless the *raw* argument
- is true.
+ Get an *option* value for the named *section*. If *vars* is provided, it
+ must be a dictionary. The *option* is looked up in *vars* (if provided),
+ *section*, and in *defaults* in that order.
+ All the ``'%'`` interpolations are expanded in the return values, unless the
+ *raw* argument is true. Values for interpolation keys are looked up in the
+ same manner as the option.
.. method:: ConfigParser.items(section[, raw[, vars]])
diff --git a/Doc/library/htmlparser.rst b/Doc/library/htmlparser.rst
index a5c185c..7b0ce03 100644
--- a/Doc/library/htmlparser.rst
+++ b/Doc/library/htmlparser.rst
@@ -148,10 +148,18 @@ An exception is defined as well:
.. method:: HTMLParser.handle_decl(decl)
- Method called when an SGML declaration is read by the parser. The *decl*
- parameter will be the entire contents of the declaration inside the ``<!``...\
- ``>`` markup. It is intended to be overridden by a derived class; the base
- class implementation does nothing.
+ Method called when an SGML ``doctype`` declaration is read by the parser.
+ The *decl* parameter will be the entire contents of the declaration inside
+ the ``<!...>`` markup. It is intended to be overridden by a derived class;
+ the base class implementation does nothing.
+
+
+.. method:: HTMLParser.unknown_decl(data)
+
+ Method called when an unrecognized SGML declaration is read by the parser.
+ The *data* parameter will be the entire contents of the declaration inside
+ the ``<!...>`` markup. It is sometimes useful to be be overridden by a
+ derived class; the base class implementation throws an :exc:`HTMLParseError`.
.. method:: HTMLParser.handle_pi(data)
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 7156a23..33630a5 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -101,7 +101,7 @@ loops that truncate the stream.
yield element
-.. function:: itertools.chain.from_iterable(iterable)
+.. classmethod:: chain.from_iterable(iterable)
Alternate constructor for :func:`chain`. Gets chained inputs from a
single iterable argument that is evaluated lazily. Equivalent to::
diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst
index c8be7af..7b4a05f 100644
--- a/Doc/library/locale.rst
+++ b/Doc/library/locale.rst
@@ -248,10 +248,6 @@ The :mod:`locale` module defines the following exception and functions:
specified, and therefore you should not assume knowledge of it on different
systems.
- .. data:: ERA_YEAR
-
- Get the year in the relevant era of the locale.
-
.. data:: ERA_D_T_FMT
Get a format string for :func:`strftime` to represent dates and times in a
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index d0042d5..9821047 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -1198,9 +1198,9 @@ in each word of a sentence except for the first and last characters::
... random.shuffle(inner_word)
... return m.group(1) + "".join(inner_word) + m.group(3)
>>> text = "Professor Abdolmalek, please report your absences promptly."
- >>> re.sub("(\w)(\w+)(\w)", repl, text)
+ >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.'
- >>> re.sub("(\w)(\w+)(\w)", repl, text)
+ >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'
diff --git a/Doc/library/select.rst b/Doc/library/select.rst
index b599d97..034756e 100644
--- a/Doc/library/select.rst
+++ b/Doc/library/select.rst
@@ -44,7 +44,7 @@ The module defines the following:
.. function:: kqueue()
- (Only supported on BSD.) Returns a kernel queue object object; see section
+ (Only supported on BSD.) Returns a kernel queue object; see section
:ref:`kqueue-objects` below for the methods supported by kqueue objects.
.. versionadded:: 2.6
@@ -52,8 +52,8 @@ The module defines the following:
.. function:: kevent(ident, filter=KQ_FILTER_READ, flags=KQ_EV_ADD, fflags=0, data=0, udata=0)
- (Only supported on BSD.) Returns a kernel event object object; see section
- :ref:`kevent-objects` below for the methods supported by kqueue objects.
+ (Only supported on BSD.) Returns a kernel event object; see section
+ :ref:`kevent-objects` below for the methods supported by kevent objects.
.. versionadded:: 2.6
diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst
index 7fcce4f..b8f2277 100644
--- a/Doc/library/urllib2.rst
+++ b/Doc/library/urllib2.rst
@@ -464,7 +464,8 @@ sorting the handler instances.
named :meth:`unknown_open`.
Note that the implementation of these methods may involve calls of the parent
- :class:`OpenerDirector` instance's :meth:`.open` and :meth:`.error` methods.
+ :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and
+ :meth:`~OpenerDirector.error` methods.
#. Every handler with a method named like :samp:`{protocol}_response` has that
method called to post-process the response.
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
index 1488329..3f481b1 100644
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -693,7 +693,7 @@ This example shows how it all works::
StopIteration
Having seen the mechanics behind the iterator protocol, it is easy to add
-iterator behavior to your classes. Define a :meth:`__iter__` method which
+iterator behavior to your classes. Define an :meth:`__iter__` method which
returns an object with a :meth:`next` method. If the class defines
:meth:`next`, then :meth:`__iter__` can just return ``self``::
@@ -710,7 +710,10 @@ returns an object with a :meth:`next` method. If the class defines
self.index = self.index - 1
return self.data[self.index]
- >>> for char in Reverse('spam'):
+ >>> rev = Reverse('spam')
+ >>> iter(rev)
+ <__main__.Reverse object at 0x00A1DB50>
+ >>> for char in rev:
... print char
...
m
diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst
index 5fd53d1..3bb12b6 100644
--- a/Doc/whatsnew/2.0.rst
+++ b/Doc/whatsnew/2.0.rst
@@ -656,7 +656,7 @@ break.
The change which will probably break the most code is tightening up the
arguments accepted by some methods. Some methods would take multiple arguments
and treat them as a tuple, particularly various list methods such as
-:meth:`.append` and :meth:`.insert`. In earlier versions of Python, if ``L`` is
+:meth:`append` and :meth:`insert`. In earlier versions of Python, if ``L`` is
a list, ``L.append( 1,2 )`` appends the tuple ``(1,2)`` to the list. In Python
2.0 this causes a :exc:`TypeError` exception to be raised, with the message:
'append requires exactly 1 argument; 2 given'. The fix is to simply add an
diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst
index ca87dbb..c7f7d58 100644
--- a/Doc/whatsnew/2.5.rst
+++ b/Doc/whatsnew/2.5.rst
@@ -1765,7 +1765,7 @@ Full documentation for ElementTree is available at
http://effbot.org/zone/element-index.htm.
ElementTree represents an XML document as a tree of element nodes. The text
-content of the document is stored as the :attr:`.text` and :attr:`.tail`
+content of the document is stored as the :attr:`text` and :attr:`tail`
attributes of (This is one of the major differences between ElementTree and
the Document Object Model; in the DOM there are many different types of node,
including :class:`TextNode`.)