From ec9a5f6399a02da00249501014a2a7207c267a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 05:55:26 +0200 Subject: Add version number for versionchanged directive (backport from 3.3) --- Doc/library/unittest.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 6036f7d..32f66fe 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -723,7 +723,7 @@ Test cases Here, we create two instances of :class:`WidgetTestCase`, each of which runs a single test. - .. versionchanged:: + .. versionchanged:: 3.2 :class:`TestCase` can be instantiated successfully without providing a method name. This makes it easier to experiment with :class:`TestCase` from the interactive interpreter. -- cgit v0.12 From 8ab3a1d7350b8fae8cf4ae4c726035152e3f59ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 18:45:50 +0200 Subject: =?UTF-8?q?Document=20that=20True/False/None=20don=E2=80=99t=20use?= =?UTF-8?q?=20:keyword:=20in=20doc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was discussed some months ago on python-dev. Having tons of links to the definition of True would be annoying, contrary to links to e.g. the nonlocal or with statements doc. --- Doc/documenting/markup.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst index c005d0c..ce39d3b 100644 --- a/Doc/documenting/markup.rst +++ b/Doc/documenting/markup.rst @@ -513,7 +513,10 @@ in a different style: .. describe:: keyword - The name of a keyword in Python. + The name of a Python keyword. Using this role will generate a link to the + documentation of the keyword. ``True``, ``False`` and ``None`` do not use + this role, but simple code markup (````True````), given that they're + fundamental to the language and should be known to any programmer. .. describe:: mailheader -- cgit v0.12 From 29cf58c9d56ee488ab12ae0110baa900f36f6ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 18:59:06 +0200 Subject: =?UTF-8?q?Document=20that=20format=20string=20don=E2=80=99t=20sup?= =?UTF-8?q?port=20arbitrary=20dictonary=20keys.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Text adapted from the PEP. Addition requested by Terry J. Reedy on 2011-02-23 on python-dev. --- Doc/library/string.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 2443180..78f2b4d 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -216,6 +216,8 @@ keyword. If it's a number, it refers to a positional argument, and if it's a ke it refers to a named keyword argument. If the numerical arg_names in a format string are 0, 1, 2, ... in sequence, they can all be omitted (not just some) and the numbers 0, 1, 2, ... will be automatically inserted in that order. +Because *arg_name* is not quote-delimited, it is not possible to specify arbitrary +dictionary keys (e.g., the strings ``'10'`` or ``':-]'``) within a format string. The *arg_name* can be followed by any number of index or attribute expressions. An expression of the form ``'.name'`` selects the named attribute using :func:`getattr`, while an expression of the form ``'[index]'`` -- cgit v0.12 From 3b371cfeb81acf571f8af9ff508acfd420b3ea8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 20:00:33 +0200 Subject: #10454: a few edits to compileall help messages --- Lib/compileall.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Lib/compileall.py b/Lib/compileall.py index 743be27..d3cff6a 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -142,7 +142,7 @@ def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=False, Arguments (all optional): - skip_curdir: if true, skip current directory (default true) + skip_curdir: if true, skip current directory (default True) maxlevels: max recursion level (default 0) force: as for compile_dir() (default False) quiet: as for compile_dir() (default False) @@ -177,17 +177,17 @@ def main(): help='use legacy (pre-PEP3147) compiled file locations') parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None, help=('directory to prepend to file paths for use in ' - 'compile time tracebacks and in runtime ' + 'compile-time tracebacks and in runtime ' 'tracebacks in cases where the source file is ' 'unavailable')) parser.add_argument('-x', metavar='REGEXP', dest='rx', default=None, - help=('skip files matching the regular expression. ' - 'The regexp is searched for in the full path ' - 'to each file considered for compilation.')) + help=('skip files matching the regular expression; ' + 'the regexp is searched for in the full path ' + 'of each file considered for compilation')) parser.add_argument('-i', metavar='FILE', dest='flist', help=('add all the files and directories listed in ' - 'FILE to the list considered for compilation. ' - 'If "-", names are read from stdin.')) + 'FILE to the list considered for compilation; ' + 'if "-", names are read from stdin')) parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*', help=('zero or more file and directory names ' 'to compile; if no arguments given, defaults ' -- cgit v0.12 From 8dad18764d59aa1cef1ff98d291eef6a568841d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 22:06:23 +0200 Subject: Remove obsolete comment --- Lib/pipes.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lib/pipes.py b/Lib/pipes.py index 51666a8..4297053 100644 --- a/Lib/pipes.py +++ b/Lib/pipes.py @@ -54,8 +54,6 @@ for the built-in function open() or for os.popen(). To create a new template object initialized to a given one: t2 = t.clone() - -For an example, see the function test() at the end of the file. """ # ' -- cgit v0.12 From 9edd9f035b9d90efbfeb5d35236a0934b106d522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 23:08:55 +0200 Subject: Fix a few links in the table of built-in functions (#12298) --- Doc/library/functions.rst | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 3b6fdc3..f5d7629 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -10,7 +10,7 @@ are always available. They are listed here in alphabetical order. =================== ================= ================== ================ ==================== .. .. Built-in Functions .. .. =================== ================= ================== ================ ==================== -:func:`abs` :func:`dict` :func:`help` :func:`min` :func:`setattr` +:func:`abs` |func-dict|_ :func:`help` :func:`min` :func:`setattr` :func:`all` :func:`dir` :func:`hex` :func:`next` :func:`slice` :func:`any` :func:`divmod` :func:`id` :func:`object` :func:`sorted` :func:`ascii` :func:`enumerate` :func:`input` :func:`oct` :func:`staticmethod` @@ -19,13 +19,22 @@ are always available. They are listed here in alphabetical order. :func:`bytearray` :func:`filter` :func:`issubclass` :func:`pow` :func:`super` :func:`bytes` :func:`float` :func:`iter` :func:`print` :func:`tuple` :func:`callable` :func:`format` :func:`len` :func:`property` :func:`type` -:func:`chr` :func:`frozenset` :func:`list` :func:`range` :func:`vars` +:func:`chr` |func-frozenset|_ :func:`list` :func:`range` :func:`vars` :func:`classmethod` :func:`getattr` :func:`locals` :func:`repr` :func:`zip` :func:`compile` :func:`globals` :func:`map` :func:`reversed` :func:`__import__` :func:`complex` :func:`hasattr` :func:`max` :func:`round` -:func:`delattr` :func:`hash` :func:`memoryview` :func:`set` +:func:`delattr` :func:`hash` |func-memoryview|_ |func-set|_ =================== ================= ================== ================ ==================== +.. using :func:`dict` would create a link to another page, so local targets are + used, with replacement texts to make the output in the table consistent + +.. |func-dict| replace:: ``dict()`` +.. |func-frozenset| replace:: ``frozenset()`` +.. |func-memoryview| replace:: ``memoryview()`` +.. |func-set| replace:: ``set()`` + + .. function:: abs(x) Return the absolute value of a number. The argument may be an @@ -248,6 +257,7 @@ are always available. They are listed here in alphabetical order. example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``. +.. _func-dict: .. function:: dict([arg]) :noindex: @@ -491,6 +501,7 @@ are always available. They are listed here in alphabetical order. The float type is described in :ref:`typesnumeric`. + .. function:: format(value[, format_spec]) .. index:: @@ -511,6 +522,8 @@ are always available. They are listed here in alphabetical order. :exc:`TypeError` exception is raised if the method is not found or if either the *format_spec* or the return value are not strings. + +.. _func-frozenset: .. function:: frozenset([iterable]) :noindex: @@ -717,6 +730,8 @@ are always available. They are listed here in alphabetical order. such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq.nlargest(1, iterable, key=keyfunc)``. + +.. _func-memoryview: .. function:: memoryview(obj) :noindex: @@ -1108,6 +1123,8 @@ are always available. They are listed here in alphabetical order. can't be represented exactly as a float. See :ref:`tut-fp-issues` for more information. + +.. _func-set: .. function:: set([iterable]) :noindex: -- cgit v0.12 From 18ddf826e70ae8d8c9ad220148e7b4af95b56650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 23:10:36 +0200 Subject: Add links from library/functions to other docs. Suggested by Terry J. Reedy in #12298. --- Doc/library/functions.rst | 13 +++++++------ Doc/library/stdtypes.rst | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index f5d7629..4ed3ec5 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -83,11 +83,12 @@ are always available. They are listed here in alphabetical order. .. function:: bool([x]) - Convert a value to a Boolean, using the standard truth testing procedure. If - *x* is false or omitted, this returns :const:`False`; otherwise it returns - :const:`True`. :class:`bool` is also a class, which is a subclass of - :class:`int`. Class :class:`bool` cannot be subclassed further. Its only - instances are :const:`False` and :const:`True`. + Convert a value to a Boolean, using the standard :ref:`truth testing + procedure `. If *x* is false or omitted, this returns ``False``; + otherwise it returns ``True``. :class:`bool` is also a class, which is a + subclass of :class:`int` (see :ref:`typesnumeric`). Class :class:`bool` + cannot be subclassed further. Its only instances are ``False`` and + ``True`` (see :ref:`bltin-boolean-values`). .. index:: pair: Boolean; type @@ -1055,7 +1056,7 @@ are always available. They are listed here in alphabetical order. Range objects implement the :class:`collections.Sequence` ABC, and provide features such as containment tests, element index lookup, slicing and - support for negative indices: + support for negative indices (see :ref:`typesseq`): >>> r = range(0, 20, 2) >>> r diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 2a9f640..f98a5f1 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2712,6 +2712,8 @@ special operations. There is exactly one ellipsis object, named It is written as ``Ellipsis`` or ``...``. +.. _bltin-notimplemented-object: + The NotImplemented Object ------------------------- @@ -2722,6 +2724,8 @@ information. It is written as ``NotImplemented``. +.. _bltin-boolean-values: + Boolean Values -------------- -- cgit v0.12 From 024de54fc234e4ad67d6f9abaef4d70d3cce0785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 1 Sep 2011 23:37:56 +0200 Subject: Fix typo (was build) and remove redundancy in docstring --- Lib/distutils/tests/support.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py index 44fcd6b..d77bbee 100644 --- a/Lib/distutils/tests/support.py +++ b/Lib/distutils/tests/support.py @@ -175,10 +175,9 @@ def _get_xxmodule_path(): def fixup_build_ext(cmd): """Function needed to make build_ext tests pass. - When Python was build with --enable-shared on Unix, -L. is not good - enough to find the libpython.so. This is because regrtest runs - it under a tempdir, not in the top level where the .so lives. By the - time we've gotten here, Python's already been chdir'd to the tempdir. + When Python was built with --enable-shared on Unix, -L. is not enough to + find libpython.so, because regrtest runs in a tempdir, not in the + source directory where the .so lives. When Python was built with in debug mode on Windows, build_ext commands need their debug attribute set, and it is not done automatically for -- cgit v0.12