diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/distutils/apiref.rst | 2 | ||||
-rw-r--r-- | Doc/distutils/examples.rst | 8 | ||||
-rw-r--r-- | Doc/library/2to3.rst | 8 | ||||
-rw-r--r-- | Doc/library/bdb.rst | 12 | ||||
-rw-r--r-- | Doc/library/io.rst | 4 | ||||
-rw-r--r-- | Doc/library/operator.rst | 156 | ||||
-rw-r--r-- | Doc/library/pdb.rst | 2 | ||||
-rw-r--r-- | Doc/library/profile.rst | 2 | ||||
-rw-r--r-- | Doc/library/pty.rst | 12 | ||||
-rw-r--r-- | Doc/library/tarfile.rst | 2 | ||||
-rw-r--r-- | Doc/library/turtle.rst | 2 | ||||
-rw-r--r-- | Doc/library/weakref.rst | 7 | ||||
-rw-r--r-- | Doc/library/zipfile.rst | 7 | ||||
-rw-r--r-- | Doc/whatsnew/2.6.rst | 10 |
14 files changed, 137 insertions, 97 deletions
diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index cdb32d3..69ec0de 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -1952,7 +1952,7 @@ This is described in more detail in :pep:`301`. The ``check`` command performs some tests on the meta-data of a package. -It makes sure for example that all required meta-data are provided through +For example, it verifies that all required meta-data are provided as the arguments passed to the :func:`setup` function. .. % todo diff --git a/Doc/distutils/examples.rst b/Doc/distutils/examples.rst index d5918a5..648063b 100644 --- a/Doc/distutils/examples.rst +++ b/Doc/distutils/examples.rst @@ -236,10 +236,10 @@ With exactly the same source tree layout, this extension can be put in the Checking a package ================== -The ``check`` command allows you to verify if your package meta-data are -meeting the minimum requirements to build a distribution. +The ``check`` command allows you to verify if your package meta-data +meet the minimum requirements to build a distribution. -To run it, just call it over your :file:`setup.py` script. If something is +To run it, just call it using your :file:`setup.py` script. If something is missing, ``check`` will display a warning. Let's take an example with a simple script:: @@ -252,7 +252,7 @@ Running the ``check`` command will display some warnings:: $ python setup.py check running check - warning: check: missing required meta-data: version ,url + warning: check: missing required meta-data: version, url warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst index f37bb05..d9eb00c 100644 --- a/Doc/library/2to3.rst +++ b/Doc/library/2to3.rst @@ -86,6 +86,14 @@ document could also be refactored with this option. The :option:`-v` option enables output of more information on the translation process. +Since some print statements can be parsed as function calls or statements, 2to3 +cannot always read files containing the print function. When 2to3 detects the +presence of the ``from __future__ import print_function`` compiler directive, it +modifies its internal grammar to interpert :func:`print` as a function. This +change can also be enabled manually with the :option:`-p` flag. Use +:option:`-p` to run fixers on code that already has had its print statements +converted. + .. _2to3-fixers: diff --git a/Doc/library/bdb.rst b/Doc/library/bdb.rst index 3e5fcd6..d6d4ae2 100644 --- a/Doc/library/bdb.rst +++ b/Doc/library/bdb.rst @@ -62,14 +62,22 @@ The :mod:`bdb` module also defines two classes: * The breakpoint hit count. -.. class:: Bdb() +.. class:: Bdb(skip=None) - The :class:`Bdb` acts as a generic Python debugger base class. + The :class:`Bdb` class acts as a generic Python debugger base class. This class takes care of the details of the trace facility; a derived class should implement user interaction. The standard debugger class (:class:`pdb.Pdb`) is an example. + The *skip* argument, if given, must be an iterable of glob-style + module name patterns. The debugger will not step into frames that + originate in a module that matches one of these patterns. Whether a + frame is considered to originate in a certain module is determined + by the ``__name__`` in the frame globals. + + .. versionadded:: 2.7 + The *skip* argument. The following methods of :class:`Bdb` normally don't need to be overridden. diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 5188b51..8fb984e 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -98,8 +98,8 @@ Module Interface *buffering* is an optional integer used to set the buffering policy. By default full buffering is on. Pass 0 to switch buffering off (only allowed - in binary mode), 1 to set line buffering, and an integer > 1 for full - buffering. + in binary mode), 1 to set line buffering, and an integer > 1 to indicate the + size of the buffer. *encoding* is the name of the encoding used to decode or encode the file. This should only be used in text mode. The default encoding is platform diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 24ace8b..175314e 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -104,6 +104,14 @@ The mathematical and bitwise operations are the most numerous: Return ``a // b``. +.. function:: index(a) + __index__(a) + + Return *a* converted to an integer. Equivalent to ``a.__index__()``. + + .. versionadded:: 2.5 + + .. function:: inv(obj) invert(obj) __inv__(obj) @@ -133,7 +141,7 @@ The mathematical and bitwise operations are the most numerous: .. function:: neg(obj) __neg__(obj) - Return *obj* negated. + Return *obj* negated (``-obj``). .. function:: or_(a, b) @@ -145,7 +153,7 @@ The mathematical and bitwise operations are the most numerous: .. function:: pos(obj) __pos__(obj) - Return *obj* positive. + Return *obj* positive (``+obj``). .. function:: pow(a, b) @@ -179,13 +187,7 @@ The mathematical and bitwise operations are the most numerous: Return the bitwise exclusive or of *a* and *b*. -.. function:: index(a) - __index__(a) - - Return *a* converted to an integer. Equivalent to ``a.__index__()``. - - -Operations which work with sequences include: +Operations which work with sequences (some of them with mappings too) include: .. function:: concat(a, b) __concat__(a, b) @@ -394,67 +396,77 @@ Mapping Operators to Functions This table shows how abstract operations correspond to operator symbols in the Python syntax and the functions in the :mod:`operator` module. -+-----------------------+-------------------------+---------------------------------+ -| Operation | Syntax | Function | -+=======================+=========================+=================================+ -| Addition | ``a + b`` | ``add(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Concatenation | ``seq1 + seq2`` | ``concat(seq1, seq2)`` | -+-----------------------+-------------------------+---------------------------------+ -| Containment Test | ``obj in seq`` | ``contains(seq, obj)`` | -+-----------------------+-------------------------+---------------------------------+ -| Division | ``a / b`` | ``truediv(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Division | ``a // b`` | ``floordiv(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Bitwise And | ``a & b`` | ``and_(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Bitwise Exclusive Or | ``a ^ b`` | ``xor(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Bitwise Inversion | ``~ a`` | ``invert(a)`` | -+-----------------------+-------------------------+---------------------------------+ -| Bitwise Or | ``a | b`` | ``or_(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Exponentiation | ``a ** b`` | ``pow(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Identity | ``a is b`` | ``is_(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Identity | ``a is not b`` | ``is_not(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Indexed Assignment | ``obj[k] = v`` | ``setitem(obj, k, v)`` | -+-----------------------+-------------------------+---------------------------------+ -| Indexed Deletion | ``del obj[k]`` | ``delitem(obj, k)`` | -+-----------------------+-------------------------+---------------------------------+ -| Indexing | ``obj[k]`` | ``getitem(obj, k)`` | -+-----------------------+-------------------------+---------------------------------+ -| Left Shift | ``a << b`` | ``lshift(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Modulo | ``a % b`` | ``mod(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Multiplication | ``a * b`` | ``mul(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Negation (Arithmetic) | ``- a`` | ``neg(a)`` | -+-----------------------+-------------------------+---------------------------------+ -| Negation (Logical) | ``not a`` | ``not_(a)`` | -+-----------------------+-------------------------+---------------------------------+ -| Right Shift | ``a >> b`` | ``rshift(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| String Formatting | ``s % obj`` | ``mod(s, obj)`` | -+-----------------------+-------------------------+---------------------------------+ -| Subtraction | ``a - b`` | ``sub(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Truth Test | ``obj`` | ``truth(obj)`` | -+-----------------------+-------------------------+---------------------------------+ -| Ordering | ``a < b`` | ``lt(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Ordering | ``a <= b`` | ``le(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Equality | ``a == b`` | ``eq(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Difference | ``a != b`` | ``ne(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Ordering | ``a >= b`` | ``ge(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ -| Ordering | ``a > b`` | ``gt(a, b)`` | -+-----------------------+-------------------------+---------------------------------+ ++-----------------------+-------------------------+---------------------------------------+ +| Operation | Syntax | Function | ++=======================+=========================+=======================================+ +| Addition | ``a + b`` | ``add(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Concatenation | ``seq1 + seq2`` | ``concat(seq1, seq2)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Containment Test | ``obj in seq`` | ``contains(seq, obj)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Division | ``a / b`` | ``div(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Division | ``a // b`` | ``floordiv(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Bitwise And | ``a & b`` | ``and_(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Bitwise Exclusive Or | ``a ^ b`` | ``xor(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Bitwise Inversion | ``~ a`` | ``invert(a)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Bitwise Or | ``a | b`` | ``or_(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Exponentiation | ``a ** b`` | ``pow(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Identity | ``a is b`` | ``is_(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Identity | ``a is not b`` | ``is_not(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Indexed Assignment | ``obj[k] = v`` | ``setitem(obj, k, v)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Indexed Deletion | ``del obj[k]`` | ``delitem(obj, k)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Indexing | ``obj[k]`` | ``getitem(obj, k)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Left Shift | ``a << b`` | ``lshift(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Modulo | ``a % b`` | ``mod(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Multiplication | ``a * b`` | ``mul(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Negation (Arithmetic) | ``- a`` | ``neg(a)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Negation (Logical) | ``not a`` | ``not_(a)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Positive | ``+ a`` | ``pos(a)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Right Shift | ``a >> b`` | ``rshift(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Sequence Repetition | ``seq * i`` | ``repeat(seq, i)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Slice Assignment | ``seq[i:j] = values`` | ``setitem(seq, slice(i, j), values)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Slice Deletion | ``del seq[i:j]`` | ``delitem(seq, slice(i, j))`` | ++-----------------------+-------------------------+---------------------------------------+ +| Slicing | ``seq[i:j]`` | ``getitem(seq, slice(i, j))`` | ++-----------------------+-------------------------+---------------------------------------+ +| String Formatting | ``s % obj`` | ``mod(s, obj)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Subtraction | ``a - b`` | ``sub(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Truth Test | ``obj`` | ``truth(obj)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Ordering | ``a < b`` | ``lt(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Ordering | ``a <= b`` | ``le(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Equality | ``a == b`` | ``eq(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Difference | ``a != b`` | ``ne(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Ordering | ``a >= b`` | ``ge(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ +| Ordering | ``a > b`` | ``gt(a, b)`` | ++-----------------------+-------------------------+---------------------------------------+ diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 96b524d..9a0c00e 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -55,7 +55,7 @@ insert :: import pdb; pdb.set_trace() at the location you want to break into the debugger. You can then step through -the code following this statement, and continue running without debugger using +the code following this statement, and continue running without the debugger using the ``c`` command. The typical usage to inspect a crashed program is:: diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index e465b56..f7df0b5 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -6,6 +6,8 @@ The Python Profilers .. sectionauthor:: James Roskind +.. module:: profile + :synopsis: Python source profiler. .. index:: single: InfoSeek Corporation diff --git a/Doc/library/pty.rst b/Doc/library/pty.rst index ac965ff..d039fdf 100644 --- a/Doc/library/pty.rst +++ b/Doc/library/pty.rst @@ -2,8 +2,8 @@ ======================================== .. module:: pty - :platform: IRIX, Linux - :synopsis: Pseudo-Terminal Handling for SGI and Linux. + :platform: Linux + :synopsis: Pseudo-Terminal Handling for Linux. .. moduleauthor:: Steen Lumholt .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il> @@ -13,8 +13,8 @@ concept: starting another process and being able to write to and read from its controlling terminal programmatically. Because pseudo-terminal handling is highly platform dependent, there is code to -do it only for SGI and Linux. (The Linux code is supposed to work on other -platforms, but hasn't been tested yet.) +do it only for Linux. (The Linux code is supposed to work on other platforms, +but hasn't been tested yet.) The :mod:`pty` module defines the following functions: @@ -31,8 +31,8 @@ The :mod:`pty` module defines the following functions: .. function:: openpty() Open a new pseudo-terminal pair, using :func:`os.openpty` if possible, or - emulation code for SGI and generic Unix systems. Return a pair of file - descriptors ``(master, slave)``, for the master and the slave end, respectively. + emulation code for generic Unix systems. Return a pair of file descriptors + ``(master, slave)``, for the master and the slave end, respectively. .. function:: spawn(argv[, master_read[, stdin_read]]) diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst index 1f53037..4d0a995 100644 --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -365,7 +365,7 @@ object, see :ref:`tarinfo-objects` for details. value. Depending on this value the respective file is either excluded (:const:`True`) or added (:const:`False`). If *filter* is specified it must be a function that takes a :class:`TarInfo` object argument and returns the - changed TarInfo object. If it instead returns :const:`None` the TarInfo + changed :class:`TarInfo` object. If it instead returns :const:`None` the :class:`TarInfo` object will be excluded from the archive. See :ref:`tar-examples` for an example. diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index d70550a..d947186 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2023,7 +2023,7 @@ The public classes of the module :mod:`turtle` Subclass of TurtleScreen, with :ref:`four methods added <screenspecific>`. -.. class:: ScrolledCavas(master) +.. class:: ScrolledCanvas(master) :param master: some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas with scrollbars added diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst index 685d207..2aa49e3 100644 --- a/Doc/library/weakref.rst +++ b/Doc/library/weakref.rst @@ -72,10 +72,9 @@ support weak references but can add support through subclassing:: obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable -.. impl-detail:: - - Other built-in types such as :class:`tuple` and :class:`long` do not support - weak references even when subclassed. +Other built-in types such as :class:`tuple` and :class:`long` do not support +weak references even when subclassed (This is an implementation detail and may +be different across various Python implementations.). Extension types can easily be made to support weak references; see :ref:`weakref-support`. diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index a7fb842..ae8751e 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -197,6 +197,13 @@ ZipFile Objects be a subset of the list returned by :meth:`namelist`. *pwd* is the password used for encrypted files. + .. warning:: + + Never extract archives from untrusted sources without prior inspection. + It is possible that files are created outside of *path*, e.g. members + that have absolute filenames starting with ``"/"`` or filenames with two + dots ``".."``. + .. method:: ZipFile.printdir() diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 27d8e5c..8b71153 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -2416,9 +2416,13 @@ changes, or look through the Subversion logs for all the details. environments. TIPC addresses are 4- or 5-tuples. (Contributed by Alberto Bertogli; :issue:`1646`.) - A new function, :func:`create_connection`, takes an address - and connects to it using an optional timeout value, returning - the connected socket object. + A new function, :func:`create_connection`, takes an address and + connects to it using an optional timeout value, returning the + connected socket object. This function also looks up the address's + type and connects to it using IPv4 or IPv6 as appropriate. Changing + your code to use :func:`create_connection` instead of + ``socket(socket.AF_INET, ...)`` may be all that's required to make + your code work with IPv6. * The base classes in the :mod:`SocketServer` module now support calling a :meth:`handle_timeout` method after a span of inactivity |