mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Recorded merge of revisions 74057 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k (Only selected revisions.) ................ r74057 | alexandre.vassalotti | 2009-07-17 12:42:05 +0200 (Fr, 17 Jul 2009) | 54 lines Merged revisions 73930-73932,73937-73939,73945,73951,73954,73962-73963,73970 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r73930 | amaury.forgeotdarc | 2009-07-10 12:47:42 -0400 (Fri, 10 Jul 2009) | 2 lines #6447: typo in subprocess docstring ........ r73937 | georg.brandl | 2009-07-11 06:12:36 -0400 (Sat, 11 Jul 2009) | 1 line Fix style. ........ r73938 | georg.brandl | 2009-07-11 06:14:54 -0400 (Sat, 11 Jul 2009) | 1 line #6446: fix import_spam() function to use correct error and reference handling. ........ r73939 | georg.brandl | 2009-07-11 06:18:10 -0400 (Sat, 11 Jul 2009) | 1 line #6448: clarify docs for find_module(). ........ r73945 | georg.brandl | 2009-07-11 06:51:31 -0400 (Sat, 11 Jul 2009) | 1 line #6456: clarify the meaning of constants used as arguments to nl_langinfo(). ........ r73951 | georg.brandl | 2009-07-11 10:23:38 -0400 (Sat, 11 Jul 2009) | 2 lines array.array is actually a class. ................
This commit is contained in:
parent
ac73c5feae
commit
a85ee5cfb6
5 changed files with 141 additions and 150 deletions
|
@ -25,6 +25,8 @@ Importing Modules
|
||||||
imported module, or *NULL* with an exception set on failure. A failing
|
imported module, or *NULL* with an exception set on failure. A failing
|
||||||
import of a module doesn't leave the module in :data:`sys.modules`.
|
import of a module doesn't leave the module in :data:`sys.modules`.
|
||||||
|
|
||||||
|
This function always uses absolute imports.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyObject* PyImport_ImportModuleNoBlock(const char *name)
|
.. cfunction:: PyObject* PyImport_ImportModuleNoBlock(const char *name)
|
||||||
|
|
||||||
|
@ -75,6 +77,8 @@ Importing Modules
|
||||||
current globals. This means that the import is done using whatever import
|
current globals. This means that the import is done using whatever import
|
||||||
hooks are installed in the current environment.
|
hooks are installed in the current environment.
|
||||||
|
|
||||||
|
This function always uses absolute imports.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m)
|
.. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m)
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ through the :attr:`itemsize` attribute.
|
||||||
The module defines the following type:
|
The module defines the following type:
|
||||||
|
|
||||||
|
|
||||||
.. function:: array(typecode[, initializer])
|
.. class:: array(typecode[, initializer])
|
||||||
|
|
||||||
Return a new array whose items are restricted by *typecode*, and initialized
|
A new array whose items are restricted by *typecode*, and initialized
|
||||||
from the optional *initializer* value, which must be a list, object
|
from the optional *initializer* value, which must be a list, object
|
||||||
supporting the buffer interface, or iterable over elements of the
|
supporting the buffer interface, or iterable over elements of the
|
||||||
appropriate type.
|
appropriate type.
|
||||||
|
@ -67,7 +67,7 @@ The module defines the following type:
|
||||||
|
|
||||||
.. data:: ArrayType
|
.. data:: ArrayType
|
||||||
|
|
||||||
Obsolete alias for :func:`array`.
|
Obsolete alias for :class:`array`.
|
||||||
|
|
||||||
.. data:: typecodes
|
.. data:: typecodes
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ and may be used wherever buffer objects are supported.
|
||||||
|
|
||||||
The following data items and methods are also supported:
|
The following data items and methods are also supported:
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: array.typecode
|
.. attribute:: array.typecode
|
||||||
|
|
||||||
The typecode character used to create the array.
|
The typecode character used to create the array.
|
||||||
|
|
|
@ -33,16 +33,17 @@ This module provides an interface to the mechanisms used to implement the
|
||||||
|
|
||||||
.. function:: find_module(name[, path])
|
.. function:: find_module(name[, path])
|
||||||
|
|
||||||
Try to find the module *name* on the search path *path*. If *path* is a list
|
Try to find the module *name*. If *path* is omitted or ``None``, the list of
|
||||||
of directory names, each directory is searched for files with any of the
|
directory names given by ``sys.path`` is searched, but first a few special
|
||||||
suffixes returned by :func:`get_suffixes` above. Invalid names in the list
|
places are searched: the function tries to find a built-in module with the
|
||||||
are silently ignored (but all list items must be strings). If *path* is
|
given name (:const:`C_BUILTIN`), then a frozen module (:const:`PY_FROZEN`),
|
||||||
omitted or ``None``, the list of directory names given by ``sys.path`` is
|
and on some systems some other places are looked in as well (on Windows, it
|
||||||
searched, but first it searches a few special places: it tries to find a
|
looks in the registry which may point to a specific file).
|
||||||
built-in module with the given name (:const:`C_BUILTIN`), then a frozen
|
|
||||||
module (:const:`PY_FROZEN`), and on some systems some other places are looked
|
Otherwise, *path* must be a list of directory names; each directory is
|
||||||
in as well (on Windows, it looks in the registry which may point to a
|
searched for files with any of the suffixes returned by :func:`get_suffixes`
|
||||||
specific file).
|
above. Invalid names in the list are silently ignored (but all list items
|
||||||
|
must be strings).
|
||||||
|
|
||||||
If search is successful, the return value is a 3-element tuple ``(file,
|
If search is successful, the return value is a 3-element tuple ``(file,
|
||||||
pathname, description)``:
|
pathname, description)``:
|
||||||
|
|
|
@ -144,13 +144,127 @@ The :mod:`locale` module defines the following exception and functions:
|
||||||
|
|
||||||
.. function:: nl_langinfo(option)
|
.. function:: nl_langinfo(option)
|
||||||
|
|
||||||
Return some locale-specific information as a string. This function is not
|
Return some locale-specific information as a string. This function is not
|
||||||
available on all systems, and the set of possible options might also vary across
|
available on all systems, and the set of possible options might also vary
|
||||||
platforms. The possible argument values are numbers, for which symbolic
|
across platforms. The possible argument values are numbers, for which
|
||||||
constants are available in the locale module.
|
symbolic constants are available in the locale module.
|
||||||
|
|
||||||
|
The :func:`nl_langinfo` function accepts one of the following keys. Most
|
||||||
|
descriptions are taken from the corresponding description in the GNU C
|
||||||
|
library.
|
||||||
|
|
||||||
|
.. data:: CODESET
|
||||||
|
|
||||||
|
Get a string with the name of the character encoding used in the
|
||||||
|
selected locale.
|
||||||
|
|
||||||
|
.. data:: D_T_FMT
|
||||||
|
|
||||||
|
Get a string that can be used as a format string for :func:`strftime` to
|
||||||
|
represent time and date in a locale-specific way.
|
||||||
|
|
||||||
|
.. data:: D_FMT
|
||||||
|
|
||||||
|
Get a string that can be used as a format string for :func:`strftime` to
|
||||||
|
represent a date in a locale-specific way.
|
||||||
|
|
||||||
|
.. data:: T_FMT
|
||||||
|
|
||||||
|
Get a string that can be used as a format string for :func:`strftime` to
|
||||||
|
represent a time in a locale-specific way.
|
||||||
|
|
||||||
|
.. data:: T_FMT_AMPM
|
||||||
|
|
||||||
|
Get a format string for :func:`strftime` to represent time in the am/pm
|
||||||
|
format.
|
||||||
|
|
||||||
|
.. data:: DAY_1 ... DAY_7
|
||||||
|
|
||||||
|
Get the name of the n-th day of the week.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This follows the US convention of :const:`DAY_1` being Sunday, not the
|
||||||
|
international convention (ISO 8601) that Monday is the first day of the
|
||||||
|
week.
|
||||||
|
|
||||||
|
.. data:: ABDAY_1 ... ABDAY_7
|
||||||
|
|
||||||
|
Get the abbreviated name of the n-th day of the week.
|
||||||
|
|
||||||
|
.. data:: MON_1 ... MON_12
|
||||||
|
|
||||||
|
Get the name of the n-th month.
|
||||||
|
|
||||||
|
.. data:: ABMON_1 ... ABMON_12
|
||||||
|
|
||||||
|
Get the abbreviated name of the n-th month.
|
||||||
|
|
||||||
|
.. data:: RADIXCHAR
|
||||||
|
|
||||||
|
Get the radix character (decimal dot, decimal comma, etc.)
|
||||||
|
|
||||||
|
.. data:: THOUSEP
|
||||||
|
|
||||||
|
Get the separator character for thousands (groups of three digits).
|
||||||
|
|
||||||
|
.. data:: YESEXPR
|
||||||
|
|
||||||
|
Get a regular expression that can be used with the regex function to
|
||||||
|
recognize a positive response to a yes/no question.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
The expression is in the syntax suitable for the :cfunc:`regex` function
|
||||||
|
from the C library, which might differ from the syntax used in :mod:`re`.
|
||||||
|
|
||||||
|
.. data:: NOEXPR
|
||||||
|
|
||||||
|
Get a regular expression that can be used with the regex(3) function to
|
||||||
|
recognize a negative response to a yes/no question.
|
||||||
|
|
||||||
|
.. data:: CRNCYSTR
|
||||||
|
|
||||||
|
Get the currency symbol, preceded by "-" if the symbol should appear before
|
||||||
|
the value, "+" if the symbol should appear after the value, or "." if the
|
||||||
|
symbol should replace the radix character.
|
||||||
|
|
||||||
|
.. data:: ERA
|
||||||
|
|
||||||
|
Get a string that represents the era used in the current locale.
|
||||||
|
|
||||||
|
Most locales do not define this value. An example of a locale which does
|
||||||
|
define this value is the Japanese one. In Japan, the traditional
|
||||||
|
representation of dates includes the name of the era corresponding to the
|
||||||
|
then-emperor's reign.
|
||||||
|
|
||||||
|
Normally it should not be necessary to use this value directly. Specifying
|
||||||
|
the ``E`` modifier in their format strings causes the :func:`strftime`
|
||||||
|
function to use this information. The format of the returned string is not
|
||||||
|
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
|
||||||
|
locale-specific era-based way.
|
||||||
|
|
||||||
|
.. data:: ERA_D_FMT
|
||||||
|
|
||||||
|
Get a format string for :func:`strftime` to represent time in a
|
||||||
|
locale-specific era-based way.
|
||||||
|
|
||||||
|
.. data:: ALT_DIGITS
|
||||||
|
|
||||||
|
Get a representation of up to 100 values used to represent the values
|
||||||
|
0 to 99.
|
||||||
|
|
||||||
|
|
||||||
.. function:: getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE'))
|
.. function:: getdefaultlocale([envvars])
|
||||||
|
|
||||||
Tries to determine the default locale settings and returns them as a tuple of
|
Tries to determine the default locale settings and returns them as a tuple of
|
||||||
the form ``(language code, encoding)``.
|
the form ``(language code, encoding)``.
|
||||||
|
@ -338,140 +452,13 @@ The :mod:`locale` module defines the following exception and functions:
|
||||||
This is a symbolic constant used for different values returned by
|
This is a symbolic constant used for different values returned by
|
||||||
:func:`localeconv`.
|
:func:`localeconv`.
|
||||||
|
|
||||||
The :func:`nl_langinfo` function accepts one of the following keys. Most
|
|
||||||
descriptions are taken from the corresponding description in the GNU C library.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: CODESET
|
|
||||||
|
|
||||||
Return a string with the name of the character encoding used in the selected
|
|
||||||
locale.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: D_T_FMT
|
|
||||||
|
|
||||||
Return a string that can be used as a format string for strftime(3) to represent
|
|
||||||
time and date in a locale-specific way.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: D_FMT
|
|
||||||
|
|
||||||
Return a string that can be used as a format string for strftime(3) to represent
|
|
||||||
a date in a locale-specific way.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: T_FMT
|
|
||||||
|
|
||||||
Return a string that can be used as a format string for strftime(3) to represent
|
|
||||||
a time in a locale-specific way.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: T_FMT_AMPM
|
|
||||||
|
|
||||||
The return value can be used as a format string for 'strftime' to represent time
|
|
||||||
in the am/pm format.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: DAY_1 ... DAY_7
|
|
||||||
|
|
||||||
Return name of the n-th day of the week.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
This follows the US convention of :const:`DAY_1` being Sunday, not the
|
|
||||||
international convention (ISO 8601) that Monday is the first day of the week.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: ABDAY_1 ... ABDAY_7
|
|
||||||
|
|
||||||
Return abbreviated name of the n-th day of the week.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: MON_1 ... MON_12
|
|
||||||
|
|
||||||
Return name of the n-th month.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: ABMON_1 ... ABMON_12
|
|
||||||
|
|
||||||
Return abbreviated name of the n-th month.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: RADIXCHAR
|
|
||||||
|
|
||||||
Return radix character (decimal dot, decimal comma, etc.)
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: THOUSEP
|
|
||||||
|
|
||||||
Return separator character for thousands (groups of three digits).
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: YESEXPR
|
|
||||||
|
|
||||||
Return a regular expression that can be used with the regex function to
|
|
||||||
recognize a positive response to a yes/no question.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The expression is in the syntax suitable for the :cfunc:`regex` function from
|
|
||||||
the C library, which might differ from the syntax used in :mod:`re`.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: NOEXPR
|
|
||||||
|
|
||||||
Return a regular expression that can be used with the regex(3) function to
|
|
||||||
recognize a negative response to a yes/no question.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: CRNCYSTR
|
|
||||||
|
|
||||||
Return the currency symbol, preceded by "-" if the symbol should appear before
|
|
||||||
the value, "+" if the symbol should appear after the value, or "." if the symbol
|
|
||||||
should replace the radix character.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: ERA
|
|
||||||
|
|
||||||
The return value represents the era used in the current locale.
|
|
||||||
|
|
||||||
Most locales do not define this value. An example of a locale which does define
|
|
||||||
this value is the Japanese one. In Japan, the traditional representation of
|
|
||||||
dates includes the name of the era corresponding to the then-emperor's reign.
|
|
||||||
|
|
||||||
Normally it should not be necessary to use this value directly. Specifying the
|
|
||||||
``E`` modifier in their format strings causes the :func:`strftime` function to
|
|
||||||
use this information. The format of the returned string is not specified, and
|
|
||||||
therefore you should not assume knowledge of it on different systems.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: ERA_YEAR
|
|
||||||
|
|
||||||
The return value gives the year in the relevant era of the locale.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: ERA_D_T_FMT
|
|
||||||
|
|
||||||
This return value can be used as a format string for :func:`strftime` to
|
|
||||||
represent dates and times in a locale-specific era-based way.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: ERA_D_FMT
|
|
||||||
|
|
||||||
This return value can be used as a format string for :func:`strftime` to
|
|
||||||
represent time in a locale-specific era-based way.
|
|
||||||
|
|
||||||
|
|
||||||
.. data:: ALT_DIGITS
|
|
||||||
|
|
||||||
The return value is a representation of up to 100 values used to represent the
|
|
||||||
values 0 to 99.
|
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
>>> import locale
|
>>> import locale
|
||||||
>>> loc = locale.getlocale() # get current locale
|
>>> loc = locale.getlocale() # get current locale
|
||||||
>>> locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name might vary with platform
|
# use German locale; name might vary with platform
|
||||||
|
>>> locale.setlocale(locale.LC_ALL, 'de_DE')
|
||||||
>>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
|
>>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
|
||||||
>>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
|
>>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
|
||||||
>>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
|
>>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
|
||||||
|
|
|
@ -723,7 +723,7 @@ class Popen(object):
|
||||||
# Windows methods
|
# Windows methods
|
||||||
#
|
#
|
||||||
def _get_handles(self, stdin, stdout, stderr):
|
def _get_handles(self, stdin, stdout, stderr):
|
||||||
"""Construct and return tupel with IO objects:
|
"""Construct and return tuple with IO objects:
|
||||||
p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
|
p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
|
||||||
"""
|
"""
|
||||||
if stdin is None and stdout is None and stderr is None:
|
if stdin is None and stdout is None and stderr is None:
|
||||||
|
@ -958,7 +958,7 @@ class Popen(object):
|
||||||
# POSIX methods
|
# POSIX methods
|
||||||
#
|
#
|
||||||
def _get_handles(self, stdin, stdout, stderr):
|
def _get_handles(self, stdin, stdout, stderr):
|
||||||
"""Construct and return tupel with IO objects:
|
"""Construct and return tuple with IO objects:
|
||||||
p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
|
p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
|
||||||
"""
|
"""
|
||||||
p2cread, p2cwrite = None, None
|
p2cread, p2cwrite = None, None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue