diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2009-07-17 10:42:05 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2009-07-17 10:42:05 (GMT) |
commit | 711ed4aedfb6b94da650c165636a676dcc22869d (patch) | |
tree | 9c82ff4f7c33b6bb8ddb4a61343c7e8c24968cb2 /Doc | |
parent | ea3714e6890654167ab4f420ee4cf09cf545ad06 (diff) | |
download | cpython-711ed4aedfb6b94da650c165636a676dcc22869d.zip cpython-711ed4aedfb6b94da650c165636a676dcc22869d.tar.gz cpython-711ed4aedfb6b94da650c165636a676dcc22869d.tar.bz2 |
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
........
r73931 | ezio.melotti | 2009-07-10 16:25:56 -0400 (Fri, 10 Jul 2009) | 1 line
more cleanups and if zlib -> skipUnless(zlib)
........
r73932 | kristjan.jonsson | 2009-07-11 04:44:43 -0400 (Sat, 11 Jul 2009) | 3 lines
http://bugs.python.org/issue6460
Need to be careful with thread switching when testing the xmlrpc server. The server thread may not have updated stats when the client thread tests them.
........
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.
........
r73954 | tarek.ziade | 2009-07-11 13:21:00 -0400 (Sat, 11 Jul 2009) | 1 line
reverted changes for #6459 (doesn't apply on 2.x)
........
r73962 | benjamin.peterson | 2009-07-11 18:15:13 -0400 (Sat, 11 Jul 2009) | 1 line
put downloaded test support files in Lib/test/data instead of the cwd
........
r73963 | benjamin.peterson | 2009-07-11 18:25:24 -0400 (Sat, 11 Jul 2009) | 1 line
ignore things in Lib/test/data/
........
r73970 | hirokazu.yamamoto | 2009-07-11 22:04:47 -0400 (Sat, 11 Jul 2009) | 1 line
Fixed distutils test.
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/import.rst | 4 | ||||
-rw-r--r-- | Doc/library/array.rst | 7 | ||||
-rw-r--r-- | Doc/library/imp.rst | 21 | ||||
-rw-r--r-- | Doc/library/locale.rst | 255 |
4 files changed, 139 insertions, 148 deletions
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index ac4cde5..2bf4079 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -25,6 +25,8 @@ Importing Modules 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`. + This function always uses absolute imports. + .. 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 hooks are installed in the current environment. + This function always uses absolute imports. + .. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m) diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 78c433d..2235f08 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -52,9 +52,9 @@ through the :attr:`itemsize` attribute. 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 supporting the buffer interface, or iterable over elements of the appropriate type. @@ -67,7 +67,7 @@ The module defines the following type: .. data:: ArrayType - Obsolete alias for :func:`array`. + Obsolete alias for :class:`array`. .. data:: typecodes @@ -81,7 +81,6 @@ and may be used wherever buffer objects are supported. The following data items and methods are also supported: - .. attribute:: array.typecode The typecode character used to create the array. diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst index 06cfefc..68cda84 100644 --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -33,16 +33,17 @@ This module provides an interface to the mechanisms used to implement the .. function:: find_module(name[, path]) - Try to find the module *name* on the search path *path*. If *path* is a list - of directory names, each directory is searched for files with any of the - suffixes returned by :func:`get_suffixes` above. Invalid names in the list - are silently ignored (but all list items must be strings). If *path* is - omitted or ``None``, the list of directory names given by ``sys.path`` is - searched, but first it searches a few special places: it tries to find a - 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 - in as well (on Windows, it looks in the registry which may point to a - specific file). + Try to find the module *name*. If *path* is omitted or ``None``, the list of + directory names given by ``sys.path`` is searched, but first a few special + places are searched: the function tries to find a 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 in as well (on Windows, it + looks in the registry which may point to a specific file). + + Otherwise, *path* must be a list of directory names; each directory is + searched for files with any of the suffixes returned by :func:`get_suffixes` + 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, pathname, description)``: diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index 163a383..9e2cab6 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -144,13 +144,127 @@ The :mod:`locale` module defines the following exception and functions: .. function:: nl_langinfo(option) - 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 - platforms. The possible argument values are numbers, for which symbolic - constants are available in the locale module. + 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 platforms. The possible argument values are numbers, for which + 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. -.. function:: getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')) + .. 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]) Tries to determine the default locale settings and returns them as a tuple of 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 :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:: >>> import 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.setlocale(locale.LC_ALL, '') # use user's preferred locale >>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale |