mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Avoid line breaks after hyphens, otherwise they are turned into spaces
This commit is contained in:
parent
536d70ed33
commit
8f1378366e
12 changed files with 64 additions and 64 deletions
|
@ -2165,8 +2165,8 @@ Speaking logging messages
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
There might be situations when it is desirable to have logging messages rendered
|
There might be situations when it is desirable to have logging messages rendered
|
||||||
in an audible rather than a visible format. This is easy to do if you have text-
|
in an audible rather than a visible format. This is easy to do if you have
|
||||||
to-speech (TTS) functionality available in your system, even if it doesn't have
|
text-to-speech (TTS) functionality available in your system, even if it doesn't have
|
||||||
a Python binding. Most TTS systems have a command line program you can run, and
|
a Python binding. Most TTS systems have a command line program you can run, and
|
||||||
this can be invoked from a handler using :mod:`subprocess`. It's assumed here
|
this can be invoked from a handler using :mod:`subprocess`. It's assumed here
|
||||||
that TTS command line programs won't expect to interact with users or take a
|
that TTS command line programs won't expect to interact with users or take a
|
||||||
|
|
|
@ -105,8 +105,8 @@ in :mod:`logging` itself) and defining handlers which are declared either in
|
||||||
:param disable_existing_loggers: If specified as ``False``, loggers which
|
:param disable_existing_loggers: If specified as ``False``, loggers which
|
||||||
exist when this call is made are left
|
exist when this call is made are left
|
||||||
enabled. The default is ``True`` because this
|
enabled. The default is ``True`` because this
|
||||||
enables old behaviour in a backward-
|
enables old behaviour in a
|
||||||
compatible way. This behaviour is to
|
backward-compatible way. This behaviour is to
|
||||||
disable any existing loggers unless they or
|
disable any existing loggers unless they or
|
||||||
their ancestors are explicitly named in the
|
their ancestors are explicitly named in the
|
||||||
logging configuration.
|
logging configuration.
|
||||||
|
|
|
@ -900,8 +900,8 @@ possible, while any potentially slow operations (such as sending an email via
|
||||||
.. class:: QueueHandler(queue)
|
.. class:: QueueHandler(queue)
|
||||||
|
|
||||||
Returns a new instance of the :class:`QueueHandler` class. The instance is
|
Returns a new instance of the :class:`QueueHandler` class. The instance is
|
||||||
initialized with the queue to send messages to. The queue can be any queue-
|
initialized with the queue to send messages to. The queue can be any
|
||||||
like object; it's used as-is by the :meth:`enqueue` method, which needs
|
queue-like object; it's used as-is by the :meth:`enqueue` method, which needs
|
||||||
to know how to send messages to it.
|
to know how to send messages to it.
|
||||||
|
|
||||||
|
|
||||||
|
@ -956,8 +956,8 @@ possible, while any potentially slow operations (such as sending an email via
|
||||||
|
|
||||||
Returns a new instance of the :class:`QueueListener` class. The instance is
|
Returns a new instance of the :class:`QueueListener` class. The instance is
|
||||||
initialized with the queue to send messages to and a list of handlers which
|
initialized with the queue to send messages to and a list of handlers which
|
||||||
will handle entries placed on the queue. The queue can be any queue-
|
will handle entries placed on the queue. The queue can be any queue-like
|
||||||
like object; it's passed as-is to the :meth:`dequeue` method, which needs
|
object; it's passed as-is to the :meth:`dequeue` method, which needs
|
||||||
to know how to get messages from it. If ``respect_handler_level`` is ``True``,
|
to know how to get messages from it. If ``respect_handler_level`` is ``True``,
|
||||||
a handler's level is respected (compared with the level for the message) when
|
a handler's level is respected (compared with the level for the message) when
|
||||||
deciding whether to pass messages to that handler; otherwise, the behaviour
|
deciding whether to pass messages to that handler; otherwise, the behaviour
|
||||||
|
|
|
@ -32,8 +32,8 @@ sending a graphics file.
|
||||||
|
|
||||||
.. function:: encode(input, output, quotetabs, header=False)
|
.. function:: encode(input, output, quotetabs, header=False)
|
||||||
|
|
||||||
Encode the contents of the *input* file and write the resulting quoted-
|
Encode the contents of the *input* file and write the resulting quoted-printable
|
||||||
printable data to the *output* file. *input* and *output* must be
|
data to the *output* file. *input* and *output* must be
|
||||||
:term:`binary file objects <file object>`. *quotetabs*, a flag which controls
|
:term:`binary file objects <file object>`. *quotetabs*, a flag which controls
|
||||||
whether to encode embedded spaces and tabs must be provideda and when true it
|
whether to encode embedded spaces and tabs must be provideda and when true it
|
||||||
encodes such embedded whitespace, and when false it leaves them unencoded.
|
encodes such embedded whitespace, and when false it leaves them unencoded.
|
||||||
|
|
|
@ -1288,8 +1288,8 @@ to sockets.
|
||||||
to transmit as opposed to sending the file until EOF is reached. File
|
to transmit as opposed to sending the file until EOF is reached. File
|
||||||
position is updated on return or also in case of error in which case
|
position is updated on return or also in case of error in which case
|
||||||
:meth:`file.tell() <io.IOBase.tell>` can be used to figure out the number of
|
:meth:`file.tell() <io.IOBase.tell>` can be used to figure out the number of
|
||||||
bytes which were sent. The socket must be of :const:`SOCK_STREAM` type. Non-
|
bytes which were sent. The socket must be of :const:`SOCK_STREAM` type.
|
||||||
blocking sockets are not supported.
|
Non-blocking sockets are not supported.
|
||||||
|
|
||||||
.. versionadded:: 3.5
|
.. versionadded:: 3.5
|
||||||
|
|
||||||
|
|
|
@ -145,8 +145,8 @@ strings. Unicode uses 16-bit numbers to represent characters instead of the
|
||||||
8-bit number used by ASCII, meaning that 65,536 distinct characters can be
|
8-bit number used by ASCII, meaning that 65,536 distinct characters can be
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
The final interface for Unicode support was arrived at through countless often-
|
The final interface for Unicode support was arrived at through countless
|
||||||
stormy discussions on the python-dev mailing list, and mostly implemented by
|
often-stormy discussions on the python-dev mailing list, and mostly implemented by
|
||||||
Marc-André Lemburg, based on a Unicode string type implementation by Fredrik
|
Marc-André Lemburg, based on a Unicode string type implementation by Fredrik
|
||||||
Lundh. A detailed explanation of the interface was written up as :pep:`100`,
|
Lundh. A detailed explanation of the interface was written up as :pep:`100`,
|
||||||
"Python Unicode Integration". This article will simply cover the most
|
"Python Unicode Integration". This article will simply cover the most
|
||||||
|
@ -885,8 +885,8 @@ interfaces for processing XML have become common: SAX2 (version 2 of the Simple
|
||||||
API for XML) provides an event-driven interface with some similarities to
|
API for XML) provides an event-driven interface with some similarities to
|
||||||
:mod:`xmllib`, and the DOM (Document Object Model) provides a tree-based
|
:mod:`xmllib`, and the DOM (Document Object Model) provides a tree-based
|
||||||
interface, transforming an XML document into a tree of nodes that can be
|
interface, transforming an XML document into a tree of nodes that can be
|
||||||
traversed and modified. Python 2.0 includes a SAX2 interface and a stripped-
|
traversed and modified. Python 2.0 includes a SAX2 interface and a stripped-down
|
||||||
down DOM interface as part of the :mod:`xml` package. Here we will give a brief
|
DOM interface as part of the :mod:`xml` package. Here we will give a brief
|
||||||
overview of these new interfaces; consult the Python documentation or the source
|
overview of these new interfaces; consult the Python documentation or the source
|
||||||
code for complete details. The Python XML SIG is also working on improved
|
code for complete details. The Python XML SIG is also working on improved
|
||||||
documentation.
|
documentation.
|
||||||
|
|
|
@ -159,8 +159,8 @@ precede any statement that will result in bytecodes being produced.
|
||||||
PEP 207: Rich Comparisons
|
PEP 207: Rich Comparisons
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
In earlier versions, Python's support for implementing comparisons on user-
|
In earlier versions, Python's support for implementing comparisons on user-defined
|
||||||
defined classes and extension types was quite simple. Classes could implement a
|
classes and extension types was quite simple. Classes could implement a
|
||||||
:meth:`__cmp__` method that was given two instances of a class, and could only
|
:meth:`__cmp__` method that was given two instances of a class, and could only
|
||||||
return 0 if they were equal or +1 or -1 if they weren't; the method couldn't
|
return 0 if they were equal or +1 or -1 if they weren't; the method couldn't
|
||||||
raise an exception or return anything other than a Boolean value. Users of
|
raise an exception or return anything other than a Boolean value. Users of
|
||||||
|
@ -465,11 +465,11 @@ Windows being the primary examples; on these systems, it's impossible to
|
||||||
distinguish the filenames ``FILE.PY`` and ``file.py``, even though they do store
|
distinguish the filenames ``FILE.PY`` and ``file.py``, even though they do store
|
||||||
the file's name in its original case (they're case-preserving, too).
|
the file's name in its original case (they're case-preserving, too).
|
||||||
|
|
||||||
In Python 2.1, the :keyword:`import` statement will work to simulate case-
|
In Python 2.1, the :keyword:`import` statement will work to simulate case-sensitivity
|
||||||
sensitivity on case-insensitive platforms. Python will now search for the first
|
on case-insensitive platforms. Python will now search for the first
|
||||||
case-sensitive match by default, raising an :exc:`ImportError` if no such file
|
case-sensitive match by default, raising an :exc:`ImportError` if no such file
|
||||||
is found, so ``import file`` will not import a module named ``FILE.PY``. Case-
|
is found, so ``import file`` will not import a module named ``FILE.PY``.
|
||||||
insensitive matching can be requested by setting the :envvar:`PYTHONCASEOK`
|
Case-insensitive matching can be requested by setting the :envvar:`PYTHONCASEOK`
|
||||||
environment variable before starting the Python interpreter.
|
environment variable before starting the Python interpreter.
|
||||||
|
|
||||||
.. ======================================================================
|
.. ======================================================================
|
||||||
|
@ -481,8 +481,8 @@ PEP 217: Interactive Display Hook
|
||||||
When using the Python interpreter interactively, the output of commands is
|
When using the Python interpreter interactively, the output of commands is
|
||||||
displayed using the built-in :func:`repr` function. In Python 2.1, the variable
|
displayed using the built-in :func:`repr` function. In Python 2.1, the variable
|
||||||
:func:`sys.displayhook` can be set to a callable object which will be called
|
:func:`sys.displayhook` can be set to a callable object which will be called
|
||||||
instead of :func:`repr`. For example, you can set it to a special pretty-
|
instead of :func:`repr`. For example, you can set it to a special
|
||||||
printing function::
|
pretty-printing function::
|
||||||
|
|
||||||
>>> # Create a recursive data structure
|
>>> # Create a recursive data structure
|
||||||
... L = [1,2,3]
|
... L = [1,2,3]
|
||||||
|
|
|
@ -962,8 +962,8 @@ New and Improved Modules
|
||||||
* The new :mod:`hmac` module implements the HMAC algorithm described by
|
* The new :mod:`hmac` module implements the HMAC algorithm described by
|
||||||
:rfc:`2104`. (Contributed by Gerhard Häring.)
|
:rfc:`2104`. (Contributed by Gerhard Häring.)
|
||||||
|
|
||||||
* Several functions that originally returned lengthy tuples now return pseudo-
|
* Several functions that originally returned lengthy tuples now return
|
||||||
sequences that still behave like tuples but also have mnemonic attributes such
|
pseudo-sequences that still behave like tuples but also have mnemonic attributes such
|
||||||
as memberst_mtime or :attr:`tm_year`. The enhanced functions include
|
as memberst_mtime or :attr:`tm_year`. The enhanced functions include
|
||||||
:func:`stat`, :func:`fstat`, :func:`statvfs`, and :func:`fstatvfs` in the
|
:func:`stat`, :func:`fstat`, :func:`statvfs`, and :func:`fstatvfs` in the
|
||||||
:mod:`os` module, and :func:`localtime`, :func:`gmtime`, and :func:`strptime` in
|
:mod:`os` module, and :func:`localtime`, :func:`gmtime`, and :func:`strptime` in
|
||||||
|
@ -1141,8 +1141,8 @@ Some of the more notable changes are:
|
||||||
|
|
||||||
The most significant change is the ability to build Python as a framework,
|
The most significant change is the ability to build Python as a framework,
|
||||||
enabled by supplying the :option:`!--enable-framework` option to the configure
|
enabled by supplying the :option:`!--enable-framework` option to the configure
|
||||||
script when compiling Python. According to Jack Jansen, "This installs a self-
|
script when compiling Python. According to Jack Jansen, "This installs a
|
||||||
contained Python installation plus the OS X framework "glue" into
|
self-contained Python installation plus the OS X framework "glue" into
|
||||||
:file:`/Library/Frameworks/Python.framework` (or another location of choice).
|
:file:`/Library/Frameworks/Python.framework` (or another location of choice).
|
||||||
For now there is little immediate added benefit to this (actually, there is the
|
For now there is little immediate added benefit to this (actually, there is the
|
||||||
disadvantage that you have to change your PATH to be able to find Python), but
|
disadvantage that you have to change your PATH to be able to find Python), but
|
||||||
|
|
|
@ -86,8 +86,8 @@ The union and intersection of sets can be computed with the :meth:`union` and
|
||||||
It's also possible to take the symmetric difference of two sets. This is the
|
It's also possible to take the symmetric difference of two sets. This is the
|
||||||
set of all elements in the union that aren't in the intersection. Another way
|
set of all elements in the union that aren't in the intersection. Another way
|
||||||
of putting it is that the symmetric difference contains all elements that are in
|
of putting it is that the symmetric difference contains all elements that are in
|
||||||
exactly one set. Again, there's an alternative notation (``^``), and an in-
|
exactly one set. Again, there's an alternative notation (``^``), and an
|
||||||
place version with the ungainly name :meth:`symmetric_difference_update`. ::
|
in-place version with the ungainly name :meth:`symmetric_difference_update`. ::
|
||||||
|
|
||||||
>>> S1 = sets.Set([1,2,3,4])
|
>>> S1 = sets.Set([1,2,3,4])
|
||||||
>>> S2 = sets.Set([3,4,5,6])
|
>>> S2 = sets.Set([3,4,5,6])
|
||||||
|
@ -288,8 +288,8 @@ use characters outside of the usual alphanumerics.
|
||||||
PEP 273: Importing Modules from ZIP Archives
|
PEP 273: Importing Modules from ZIP Archives
|
||||||
============================================
|
============================================
|
||||||
|
|
||||||
The new :mod:`zipimport` module adds support for importing modules from a ZIP-
|
The new :mod:`zipimport` module adds support for importing modules from a
|
||||||
format archive. You don't need to import the module explicitly; it will be
|
ZIP-format archive. You don't need to import the module explicitly; it will be
|
||||||
automatically imported if a ZIP archive's filename is added to ``sys.path``.
|
automatically imported if a ZIP archive's filename is added to ``sys.path``.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
@ -375,8 +375,8 @@ PEP 278: Universal Newline Support
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
The three major operating systems used today are Microsoft Windows, Apple's
|
The three major operating systems used today are Microsoft Windows, Apple's
|
||||||
Macintosh OS, and the various Unix derivatives. A minor irritation of cross-
|
Macintosh OS, and the various Unix derivatives. A minor irritation of
|
||||||
platform work is that these three platforms all use different characters to
|
cross-platform work is that these three platforms all use different characters to
|
||||||
mark the ends of lines in text files. Unix uses the linefeed (ASCII character
|
mark the ends of lines in text files. Unix uses the linefeed (ASCII character
|
||||||
10), MacOS uses the carriage return (ASCII character 13), and Windows uses a
|
10), MacOS uses the carriage return (ASCII character 13), and Windows uses a
|
||||||
two-character sequence of a carriage return plus a newline.
|
two-character sequence of a carriage return plus a newline.
|
||||||
|
|
|
@ -517,8 +517,8 @@ Sometimes you can see this inaccuracy when the number is printed::
|
||||||
>>> 1.1
|
>>> 1.1
|
||||||
1.1000000000000001
|
1.1000000000000001
|
||||||
|
|
||||||
The inaccuracy isn't always visible when you print the number because the FP-to-
|
The inaccuracy isn't always visible when you print the number because the
|
||||||
decimal-string conversion is provided by the C library, and most C libraries try
|
FP-to-decimal-string conversion is provided by the C library, and most C libraries try
|
||||||
to produce sensible output. Even if it's not displayed, however, the inaccuracy
|
to produce sensible output. Even if it's not displayed, however, the inaccuracy
|
||||||
is still there and subsequent operations can magnify the error.
|
is still there and subsequent operations can magnify the error.
|
||||||
|
|
||||||
|
@ -595,8 +595,8 @@ exponent::
|
||||||
...
|
...
|
||||||
decimal.InvalidOperation: x ** (non-integer)
|
decimal.InvalidOperation: x ** (non-integer)
|
||||||
|
|
||||||
You can combine :class:`Decimal` instances with integers, but not with floating-
|
You can combine :class:`Decimal` instances with integers, but not with
|
||||||
point numbers::
|
floating-point numbers::
|
||||||
|
|
||||||
>>> a + 4
|
>>> a + 4
|
||||||
Decimal("39.72")
|
Decimal("39.72")
|
||||||
|
@ -684,8 +684,8 @@ includes a quick-start tutorial and a reference.
|
||||||
Raymond Hettinger, Aahz, and Tim Peters.
|
Raymond Hettinger, Aahz, and Tim Peters.
|
||||||
|
|
||||||
http://www.lahey.com/float.htm
|
http://www.lahey.com/float.htm
|
||||||
The article uses Fortran code to illustrate many of the problems that floating-
|
The article uses Fortran code to illustrate many of the problems that
|
||||||
point inaccuracy can cause.
|
floating-point inaccuracy can cause.
|
||||||
|
|
||||||
http://speleotrove.com/decimal/
|
http://speleotrove.com/decimal/
|
||||||
A description of a decimal-based representation. This representation is being
|
A description of a decimal-based representation. This representation is being
|
||||||
|
@ -741,8 +741,8 @@ functions in Python's implementation required that the numeric locale remain set
|
||||||
to the ``'C'`` locale. Often this was because the code was using the C
|
to the ``'C'`` locale. Often this was because the code was using the C
|
||||||
library's :c:func:`atof` function.
|
library's :c:func:`atof` function.
|
||||||
|
|
||||||
Not setting the numeric locale caused trouble for extensions that used third-
|
Not setting the numeric locale caused trouble for extensions that used third-party
|
||||||
party C libraries, however, because they wouldn't have the correct locale set.
|
C libraries, however, because they wouldn't have the correct locale set.
|
||||||
The motivating example was GTK+, whose user interface widgets weren't displaying
|
The motivating example was GTK+, whose user interface widgets weren't displaying
|
||||||
numbers in the current locale.
|
numbers in the current locale.
|
||||||
|
|
||||||
|
@ -918,8 +918,8 @@ Here are all of the changes that Python 2.4 makes to the core Python language.
|
||||||
|
|
||||||
(Contributed by Raymond Hettinger.)
|
(Contributed by Raymond Hettinger.)
|
||||||
|
|
||||||
* Encountering a failure while importing a module no longer leaves a partially-
|
* Encountering a failure while importing a module no longer leaves a partially-initialized
|
||||||
initialized module object in ``sys.modules``. The incomplete module object left
|
module object in ``sys.modules``. The incomplete module object left
|
||||||
behind would fool further imports of the same module into succeeding, leading to
|
behind would fool further imports of the same module into succeeding, leading to
|
||||||
confusing errors. (Fixed by Tim Peters.)
|
confusing errors. (Fixed by Tim Peters.)
|
||||||
|
|
||||||
|
@ -1028,8 +1028,8 @@ complete list of changes, or look through the CVS logs for all the details.
|
||||||
previous ones left off. (Implemented by Walter Dörwald.)
|
previous ones left off. (Implemented by Walter Dörwald.)
|
||||||
|
|
||||||
* There is a new :mod:`collections` module for various specialized collection
|
* There is a new :mod:`collections` module for various specialized collection
|
||||||
datatypes. Currently it contains just one type, :class:`deque`, a double-
|
datatypes. Currently it contains just one type, :class:`deque`, a double-ended
|
||||||
ended queue that supports efficiently adding and removing elements from either
|
queue that supports efficiently adding and removing elements from either
|
||||||
end::
|
end::
|
||||||
|
|
||||||
>>> from collections import deque
|
>>> from collections import deque
|
||||||
|
@ -1485,8 +1485,8 @@ Some of the changes to Python's build process and to the C API are:
|
||||||
intended as an aid to people developing the Python core. Providing
|
intended as an aid to people developing the Python core. Providing
|
||||||
:option:`!--enable-profiling` to the :program:`configure` script will let you
|
:option:`!--enable-profiling` to the :program:`configure` script will let you
|
||||||
profile the interpreter with :program:`gprof`, and providing the
|
profile the interpreter with :program:`gprof`, and providing the
|
||||||
:option:`!--with-tsc` switch enables profiling using the Pentium's Time-Stamp-
|
:option:`!--with-tsc` switch enables profiling using the Pentium's
|
||||||
Counter register. Note that the :option:`!--with-tsc` switch is slightly
|
Time-Stamp-Counter register. Note that the :option:`!--with-tsc` switch is slightly
|
||||||
misnamed, because the profiling feature also works on the PowerPC platform,
|
misnamed, because the profiling feature also works on the PowerPC platform,
|
||||||
though that processor architecture doesn't call that register "the TSC
|
though that processor architecture doesn't call that register "the TSC
|
||||||
register". (Contributed by Jeremy Hylton.)
|
register". (Contributed by Jeremy Hylton.)
|
||||||
|
@ -1540,8 +1540,8 @@ code:
|
||||||
|
|
||||||
* The :mod:`tarfile` module now generates GNU-format tar files by default.
|
* The :mod:`tarfile` module now generates GNU-format tar files by default.
|
||||||
|
|
||||||
* Encountering a failure while importing a module no longer leaves a partially-
|
* Encountering a failure while importing a module no longer leaves a
|
||||||
initialized module object in ``sys.modules``.
|
partially-initialized module object in ``sys.modules``.
|
||||||
|
|
||||||
* :const:`None` is now a constant; code that binds a new value to the name
|
* :const:`None` is now a constant; code that binds a new value to the name
|
||||||
``None`` is now a syntax error.
|
``None`` is now a syntax error.
|
||||||
|
|
|
@ -157,8 +157,8 @@ Here's a small but realistic example::
|
||||||
server_log = functools.partial(log, subsystem='server')
|
server_log = functools.partial(log, subsystem='server')
|
||||||
server_log('Unable to open socket')
|
server_log('Unable to open socket')
|
||||||
|
|
||||||
Here's another example, from a program that uses PyGTK. Here a context-
|
Here's another example, from a program that uses PyGTK. Here a context-sensitive
|
||||||
sensitive pop-up menu is being constructed dynamically. The callback provided
|
pop-up menu is being constructed dynamically. The callback provided
|
||||||
for the menu option is a partially applied version of the :meth:`open_item`
|
for the menu option is a partially applied version of the :meth:`open_item`
|
||||||
method, where the first argument has been provided. ::
|
method, where the first argument has been provided. ::
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ method, where the first argument has been provided. ::
|
||||||
popup_menu.append( ("Open", open_func, 1) )
|
popup_menu.append( ("Open", open_func, 1) )
|
||||||
|
|
||||||
Another function in the :mod:`functools` module is the
|
Another function in the :mod:`functools` module is the
|
||||||
``update_wrapper(wrapper, wrapped)`` function that helps you write well-
|
``update_wrapper(wrapper, wrapped)`` function that helps you write
|
||||||
behaved decorators. :func:`update_wrapper` copies the name, module, and
|
well-behaved decorators. :func:`update_wrapper` copies the name, module, and
|
||||||
docstring attribute to a wrapper function so that tracebacks inside the wrapped
|
docstring attribute to a wrapper function so that tracebacks inside the wrapped
|
||||||
function are easier to understand. For example, you might write::
|
function are easier to understand. For example, you might write::
|
||||||
|
|
||||||
|
@ -297,8 +297,8 @@ can't protect against having your submodule's name being used for a new module
|
||||||
added in a future version of Python.
|
added in a future version of Python.
|
||||||
|
|
||||||
In Python 2.5, you can switch :keyword:`import`'s behaviour to absolute imports
|
In Python 2.5, you can switch :keyword:`import`'s behaviour to absolute imports
|
||||||
using a ``from __future__ import absolute_import`` directive. This absolute-
|
using a ``from __future__ import absolute_import`` directive. This absolute-import
|
||||||
import behaviour will become the default in a future version (probably Python
|
behaviour will become the default in a future version (probably Python
|
||||||
2.7). Once absolute imports are the default, ``import string`` will always
|
2.7). Once absolute imports are the default, ``import string`` will always
|
||||||
find the standard library's version. It's suggested that users should begin
|
find the standard library's version. It's suggested that users should begin
|
||||||
using absolute imports as much as possible, so it's preferable to begin writing
|
using absolute imports as much as possible, so it's preferable to begin writing
|
||||||
|
@ -602,8 +602,8 @@ be used with the ':keyword:`with`' statement. File objects are one example::
|
||||||
... more processing code ...
|
... more processing code ...
|
||||||
|
|
||||||
After this statement has executed, the file object in *f* will have been
|
After this statement has executed, the file object in *f* will have been
|
||||||
automatically closed, even if the :keyword:`for` loop raised an exception part-
|
automatically closed, even if the :keyword:`for` loop raised an exception
|
||||||
way through the block.
|
part-way through the block.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
@ -1558,8 +1558,8 @@ complete list of changes, or look through the SVN logs for all the details.
|
||||||
|
|
||||||
You can also pack and unpack data to and from buffer objects directly using the
|
You can also pack and unpack data to and from buffer objects directly using the
|
||||||
``pack_into(buffer, offset, v1, v2, ...)`` and ``unpack_from(buffer,
|
``pack_into(buffer, offset, v1, v2, ...)`` and ``unpack_from(buffer,
|
||||||
offset)`` methods. This lets you store data directly into an array or a memory-
|
offset)`` methods. This lets you store data directly into an array or a
|
||||||
mapped file.
|
memory-mapped file.
|
||||||
|
|
||||||
(:class:`Struct` objects were implemented by Bob Ippolito at the NeedForSpeed
|
(:class:`Struct` objects were implemented by Bob Ippolito at the NeedForSpeed
|
||||||
sprint. Support for buffer objects was added by Martin Blais, also at the
|
sprint. Support for buffer objects was added by Martin Blais, also at the
|
||||||
|
@ -2281,8 +2281,8 @@ Acknowledgements
|
||||||
|
|
||||||
The author would like to thank the following people for offering suggestions,
|
The author would like to thank the following people for offering suggestions,
|
||||||
corrections and assistance with various drafts of this article: Georg Brandl,
|
corrections and assistance with various drafts of this article: Georg Brandl,
|
||||||
Nick Coghlan, Phillip J. Eby, Lars Gustäbel, Raymond Hettinger, Ralf W. Grosse-
|
Nick Coghlan, Phillip J. Eby, Lars Gustäbel, Raymond Hettinger, Ralf W.
|
||||||
Kunstleve, Kent Johnson, Iain Lowe, Martin von Löwis, Fredrik Lundh, Andrew
|
Grosse-Kunstleve, Kent Johnson, Iain Lowe, Martin von Löwis, Fredrik Lundh, Andrew
|
||||||
McNamara, Skip Montanaro, Gustavo Niemeyer, Paul Prescod, James Pryor, Mike
|
McNamara, Skip Montanaro, Gustavo Niemeyer, Paul Prescod, James Pryor, Mike
|
||||||
Rovner, Scott Weikart, Barry Warsaw, Thomas Wouters.
|
Rovner, Scott Weikart, Barry Warsaw, Thomas Wouters.
|
||||||
|
|
||||||
|
|
|
@ -290,8 +290,8 @@ be used with the ':keyword:`with`' statement. File objects are one example::
|
||||||
... more processing code ...
|
... more processing code ...
|
||||||
|
|
||||||
After this statement has executed, the file object in *f* will have been
|
After this statement has executed, the file object in *f* will have been
|
||||||
automatically closed, even if the :keyword:`for` loop raised an exception part-
|
automatically closed, even if the :keyword:`for` loop raised an exception
|
||||||
way through the block.
|
part-way through the block.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue