diff options
author | Georg Brandl <georg@python.org> | 2009-04-05 21:21:05 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-05 21:21:05 (GMT) |
commit | 9b08e05e1eb64aff77b6dc77226b1794bd33a154 (patch) | |
tree | d35fd76312a076d60610bc56dce5d541ded33c52 /Doc | |
parent | 8943caf716095082d6277110919a1c4c63487820 (diff) | |
download | cpython-9b08e05e1eb64aff77b6dc77226b1794bd33a154.zip cpython-9b08e05e1eb64aff77b6dc77226b1794bd33a154.tar.gz cpython-9b08e05e1eb64aff77b6dc77226b1794bd33a154.tar.bz2 |
Merged revisions 70866-70868,70870-70871,70893,70896,70902,70905,70907,70912,70915,70927,70933,70940,70944,70954,70963,70998,71056 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70866 | georg.brandl | 2009-03-31 21:06:57 +0200 (Di, 31 Mär 2009) | 1 line
#4882: document named group behavior a bit better.
........
r70867 | georg.brandl | 2009-03-31 21:10:35 +0200 (Di, 31 Mär 2009) | 1 line
#1096310: document usage of sys.__std*__ a bit better.
........
r70868 | georg.brandl | 2009-03-31 21:12:17 +0200 (Di, 31 Mär 2009) | 1 line
#5190: export make_option in __all__.
........
r70870 | georg.brandl | 2009-03-31 21:26:24 +0200 (Di, 31 Mär 2009) | 1 line
#4411: document mro() and __mro__. (I hope I got it right.)
........
r70871 | georg.brandl | 2009-03-31 21:30:56 +0200 (Di, 31 Mär 2009) | 1 line
#5618: fix typo.
........
r70893 | georg.brandl | 2009-03-31 22:56:32 +0200 (Di, 31 Mär 2009) | 1 line
#1530012: move TQS section before raw strings.
........
r70896 | georg.brandl | 2009-03-31 23:15:33 +0200 (Di, 31 Mär 2009) | 1 line
#5598: document DocFileSuite *args argument.
........
r70902 | georg.brandl | 2009-03-31 23:43:03 +0200 (Di, 31 Mär 2009) | 1 line
#1675026: add a note about a strange Windows problem, and remove notes about AtheOS.
........
r70905 | georg.brandl | 2009-04-01 00:03:40 +0200 (Mi, 01 Apr 2009) | 1 line
#5563: more documentation for bdist_msi.
........
r70907 | georg.brandl | 2009-04-01 00:18:19 +0200 (Mi, 01 Apr 2009) | 1 line
#3427: document correct return type for urlopen().info().
........
r70912 | georg.brandl | 2009-04-01 00:35:46 +0200 (Mi, 01 Apr 2009) | 1 line
#5617: add a handy function to print a unicode string to gdbinit.
........
r70915 | georg.brandl | 2009-04-01 00:40:16 +0200 (Mi, 01 Apr 2009) | 1 line
#5018: remove confusing paragraph.
........
r70927 | georg.brandl | 2009-04-01 01:01:27 +0200 (Mi, 01 Apr 2009) | 1 line
Dont shout to users.
........
r70933 | georg.brandl | 2009-04-01 02:04:33 +0200 (Mi, 01 Apr 2009) | 2 lines
Issue #5635: Fix running test_sys with tracing enabled.
........
r70940 | georg.brandl | 2009-04-01 06:21:14 +0200 (Mi, 01 Apr 2009) | 2 lines
The SimpleXMLRPCServer's CGI handler now runs like a pony.
........
r70944 | georg.brandl | 2009-04-01 06:32:39 +0200 (Mi, 01 Apr 2009) | 1 line
#5631: add upload to list of possible commands, which is presented in --help-commands.
........
r70954 | georg.brandl | 2009-04-01 17:23:43 +0200 (Mi, 01 Apr 2009) | 1 line
Fix test_xmlrpc and make the CGI handler work with no CONTENT_LENGTH.
........
r70963 | georg.brandl | 2009-04-01 19:46:01 +0200 (Mi, 01 Apr 2009) | 1 line
#5655: fix docstring oversight.
........
r70998 | georg.brandl | 2009-04-01 23:54:21 +0200 (Mi, 01 Apr 2009) | 1 line
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
........
r71056 | georg.brandl | 2009-04-02 19:43:07 +0200 (Do, 02 Apr 2009) | 2 lines
Actually the displayhook should print the repr.
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/structures.rst | 2 | ||||
-rw-r--r-- | Doc/distutils/apiref.rst | 10 | ||||
-rw-r--r-- | Doc/library/doctest.rst | 66 | ||||
-rw-r--r-- | Doc/library/re.rst | 16 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 17 | ||||
-rw-r--r-- | Doc/library/sys.rst | 11 | ||||
-rw-r--r-- | Doc/library/urllib.rst | 2 | ||||
-rw-r--r-- | Doc/tutorial/datastructures.rst | 12 | ||||
-rw-r--r-- | Doc/tutorial/introduction.rst | 29 |
9 files changed, 97 insertions, 68 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index e92827d..c79c4cb 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -247,7 +247,7 @@ definition with the same method name. T_OBJECT_EX PyObject \* T_CHAR char T_BYTE char - T_UNBYTE unsigned char + T_UBYTE unsigned char T_UINT unsigned int T_USHORT unsigned short T_ULONG unsigned long diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 4d65de0..b4887cf 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -1775,8 +1775,16 @@ This module supplies the abstract base class :class:`Command`. .. module:: distutils.command.bdist_msi :synopsis: Build a binary distribution as a Windows MSI file +.. class:: bdist_msi(Command) -.. % todo + Builds a `Windows Installer`_ (.msi) binary package. + + .. _Windows Installer: http://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx + + In most cases, the ``bdist_msi`` installer is a better choice than the + ``bdist_wininst`` installer, because it provides better support for + Win64 platforms, allows administrators to perform non-interactive + installations, and allows installation through group policies. :mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a Redhat RPM and SRPM diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index 31e6d0f..bd990b4 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -965,7 +965,7 @@ There are two main functions for creating :class:`unittest.TestSuite` instances from text files and modules with doctests: -.. function:: DocFileSuite([module_relative][, package][, setUp][, tearDown][, globs][, optionflags][, parser][, encoding]) +.. function:: DocFileSuite(*paths, [module_relative][, package][, setUp][, tearDown][, globs][, optionflags][, parser][, encoding]) Convert doctest tests from one or more text files to a :class:`unittest.TestSuite`. @@ -983,45 +983,47 @@ from text files and modules with doctests: Optional argument *module_relative* specifies how the filenames in *paths* should be interpreted: - * If *module_relative* is ``True`` (the default), then each filename specifies - an OS-independent module-relative path. By default, this path is relative to - the calling module's directory; but if the *package* argument is specified, then - it is relative to that package. To ensure OS-independence, each filename should - use ``/`` characters to separate path segments, and may not be an absolute path - (i.e., it may not begin with ``/``). - - * If *module_relative* is ``False``, then each filename specifies an OS-specific - path. The path may be absolute or relative; relative paths are resolved with - respect to the current working directory. - - Optional argument *package* is a Python package or the name of a Python package - whose directory should be used as the base directory for module-relative - filenames. If no package is specified, then the calling module's directory is - used as the base directory for module-relative filenames. It is an error to - specify *package* if *module_relative* is ``False``. - - Optional argument *setUp* specifies a set-up function for the test suite. This - is called before running the tests in each file. The *setUp* function will be - passed a :class:`DocTest` object. The setUp function can access the test - globals as the *globs* attribute of the test passed. - - Optional argument *tearDown* specifies a tear-down function for the test suite. - This is called after running the tests in each file. The *tearDown* function + * If *module_relative* is ``True`` (the default), then each filename in + *paths* specifies an OS-independent module-relative path. By default, this + path is relative to the calling module's directory; but if the *package* + argument is specified, then it is relative to that package. To ensure + OS-independence, each filename should use ``/`` characters to separate path + segments, and may not be an absolute path (i.e., it may not begin with + ``/``). + + * If *module_relative* is ``False``, then each filename in *paths* specifies + an OS-specific path. The path may be absolute or relative; relative paths + are resolved with respect to the current working directory. + + Optional argument *package* is a Python package or the name of a Python + package whose directory should be used as the base directory for + module-relative filenames in *paths*. If no package is specified, then the + calling module's directory is used as the base directory for module-relative + filenames. It is an error to specify *package* if *module_relative* is + ``False``. + + Optional argument *setUp* specifies a set-up function for the test suite. + This is called before running the tests in each file. The *setUp* function will be passed a :class:`DocTest` object. The setUp function can access the test globals as the *globs* attribute of the test passed. + Optional argument *tearDown* specifies a tear-down function for the test + suite. This is called after running the tests in each file. The *tearDown* + function will be passed a :class:`DocTest` object. The setUp function can + access the test globals as the *globs* attribute of the test passed. + Optional argument *globs* is a dictionary containing the initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is a new empty dictionary. Optional argument *optionflags* specifies the default doctest options for the tests, created by or-ing together individual option flags. See section - :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below for - a better way to set reporting options. + :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below + for a better way to set reporting options. - Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) that - should be used to extract tests from the files. It defaults to a normal parser - (i.e., ``DocTestParser()``). + Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) + that should be used to extract tests from the files. It defaults to a normal + parser (i.e., ``DocTestParser()``). Optional argument *encoding* specifies an encoding that should be used to convert the file to unicode. @@ -1029,8 +1031,8 @@ from text files and modules with doctests: .. versionadded:: 2.4 .. versionchanged:: 2.5 - The global ``__file__`` was added to the globals provided to doctests loaded - from a text file using :func:`DocFileSuite`. + The global ``__file__`` was added to the globals provided to doctests + loaded from a text file using :func:`DocFileSuite`. .. versionchanged:: 2.5 The parameter *encoding* was added. diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 906444a..6ff89ea 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -231,16 +231,18 @@ The special characters are: ``(?P<name>...)`` Similar to regular parentheses, but the substring matched by the group is - accessible via the symbolic group name *name*. Group names must be valid Python - identifiers, and each group name must be defined only once within a regular - expression. A symbolic group is also a numbered group, just as if the group - were not named. So the group named 'id' in the example below can also be - referenced as the numbered group 1. + accessible within the rest of the regular expression via the symbolic group + name *name*. Group names must be valid Python identifiers, and each group + name must be defined only once within a regular expression. A symbolic group + is also a numbered group, just as if the group were not named. So the group + named ``id`` in the example below can also be referenced as the numbered group + ``1``. For example, if the pattern is ``(?P<id>[a-zA-Z_]\w*)``, the group can be referenced by its name in arguments to methods of match objects, such as - ``m.group('id')`` or ``m.end('id')``, and also by name in pattern text (for - example, ``(?P=id)``) and replacement text (such as ``\g<id>``). + ``m.group('id')`` or ``m.end('id')``, and also by name in the regular + expression itself (using ``(?P=id)``) and replacement text given to + ``.sub()`` (using ``\g<id>``). ``(?P=name)`` Matches whatever text was matched by the earlier group named *name*. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 9c207b0..998ae77 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2653,9 +2653,24 @@ types, where they are relevant. Some of these are not reported by the The name of the class or type. +The following attributes are only supported by :term:`new-style class`\ es. + +.. attribute:: class.__mro__ + + This attribute is a tuple of classes that are considered when looking for + base classes during method resolution. + + +.. method:: class.mro() + + This method can be overridden by a metaclass to customize the method + resolution order for its instances. It is called at class instantiation, and + its result is stored in :attr:`__mro__`. + + .. method:: class.__subclasses__ - :term:`New-style class`\ es keep a list of weak references to their immediate + Each new-style class keeps a list of weak references to its immediate subclasses. This method returns a list of all those references still alive. Example:: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index b556a3c..a476f4d 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -850,9 +850,14 @@ always available. __stderr__ These objects contain the original values of ``stdin``, ``stderr`` and - ``stdout`` at the start of the program. They are used during finalization, and - could be useful to restore the actual files to known working file objects in - case they have been overwritten with a broken object. + ``stdout`` at the start of the program. They are used during finalization, + and could be useful to print to the actual standard stream no matter if the + ``sys.std*`` object has been redirected. + + It can also be used to restore the actual files to known working file objects + in case they have been overwritten with a broken object. However, the + preferred way to do this is to explicitly save the previous stream before + replacing it, and restore the saved object. .. data:: tracebacklimit diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst index 1d02b1c..905c324 100644 --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -49,7 +49,7 @@ High-level interface .. index:: module: mimetools The :meth:`info` method returns an instance of the class - :class:`mimetools.Message` containing meta-information associated with the + :class:`httplib.HTTPMessage` containing meta-information associated with the URL. When the method is HTTP, these headers are those returned by the server at the head of the retrieved HTML page (including Content-Length and Content-Type). When the method is FTP, a Content-Length header will be diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index 2cc1e60..047ae36 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -401,13 +401,11 @@ The reverse operation is also possible:: >>> x, y, z = t -This is called, appropriately enough, *sequence unpacking*. Sequence unpacking -requires the list of variables on the left to have the same number of elements -as the length of the sequence. Note that multiple assignment is really just a -combination of tuple packing and sequence unpacking! - -There is a small bit of asymmetry here: packing multiple values always creates -a tuple, and unpacking works for any sequence. +This is called, appropriately enough, *sequence unpacking* and works for any +sequence on the right-hand side. Sequence unpacking requires the list of +variables on the left to have the same number of elements as the length of the +sequence. Note that multiple assignment is really just a combination of tuple +packing and sequence unpacking. .. XXX Add a bit on the difference between tuples and lists. diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index 99e82a3..21d3627 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -199,21 +199,6 @@ the following:: several lines of text just as you would do in C. Note that whitespace at the beginning of the line is significant. -If we make the string literal a "raw" string, however, the ``\n`` sequences are -not converted to newlines, but the backslash at the end of the line, and the -newline character in the source, are both included in the string as data. Thus, -the example:: - - hello = r"This is a rather long string containing\n\ - several lines of text much as you would do in C." - - print hello - -would print:: - - This is a rather long string containing\n\ - several lines of text much as you would do in C. - Or, strings can be surrounded in a pair of matching triple-quotes: ``"""`` or ``'''``. End of lines do not need to be escaped when using triple-quotes, but they will be included in the string. :: @@ -230,6 +215,20 @@ produces the following output:: -h Display this usage message -H hostname Hostname to connect to +If we make the string literal a "raw" string, ``\n`` sequences are not converted +to newlines, but the backslash at the end of the line, and the newline character +in the source, are both included in the string as data. Thus, the example:: + + hello = r"This is a rather long string containing\n\ + several lines of text much as you would do in C." + + print hello + +would print:: + + This is a rather long string containing\n\ + several lines of text much as you would do in C. + The interpreter prints the result of string operations in the same way as they are typed for input: inside quotes, and with quotes and other funny characters escaped by backslashes, to show the precise value. The string is enclosed in |