From bde4998c653716bfce79557e5e3ea5aec8ea6c45 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 1 Aug 2010 22:19:17 +0000 Subject: [PATCH] Merged revisions 82793-82794,82807,82876,83432 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/release27-maint ................ r82793 | georg.brandl | 2010-07-11 10:56:18 +0200 (So, 11 Jul 2010) | 9 lines Merged revisions 82790 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82790 | georg.brandl | 2010-07-11 10:36:20 +0200 (So, 11 Jul 2010) | 1 line #3214 followup: add link to ABC entry. ........ ................ r82794 | georg.brandl | 2010-07-11 10:57:05 +0200 (So, 11 Jul 2010) | 9 lines Merged revisions 82789 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82789 | georg.brandl | 2010-07-11 10:33:16 +0200 (So, 11 Jul 2010) | 1 line Silence makeindex. ........ ................ r82807 | georg.brandl | 2010-07-11 12:29:37 +0200 (So, 11 Jul 2010) | 9 lines Merged revisions 82806 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82806 | georg.brandl | 2010-07-11 12:22:44 +0200 (So, 11 Jul 2010) | 1 line #9223: link to Command class reference, and move Command interface docs nearer to class docs. ........ ................ r82876 | georg.brandl | 2010-07-14 10:55:55 +0200 (Mi, 14 Jul 2010) | 13 lines Merged revisions 82872,82874 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82872 | georg.brandl | 2010-07-14 10:53:18 +0200 (Mi, 14 Jul 2010) | 1 line Remove XXX from text. ........ r82874 | georg.brandl | 2010-07-14 10:54:40 +0200 (Mi, 14 Jul 2010) | 1 line #9235: fix missing import of sys. ........ ................ r83432 | georg.brandl | 2010-08-01 21:21:26 +0200 (So, 01 Aug 2010) | 13 lines Merged revisions 83328,83341 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83328 | raymond.hettinger | 2010-07-31 12:14:41 +0200 (Sa, 31 Jul 2010) | 1 line Document how to change OrderedDict update order from first to last. ........ r83341 | georg.brandl | 2010-07-31 13:40:07 +0200 (Sa, 31 Jul 2010) | 1 line #9430: document timedelta str() and repr(). ........ ................ --- Doc/Makefile | 2 ++ Doc/distutils/apiref.rst | 2 +- Doc/distutils/extending.rst | 4 ++-- Doc/glossary.rst | 6 +++--- Doc/library/datetime.rst | 18 ++++++++++++++++++ 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile index f82acebd93..f904e5fbea 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -143,6 +143,7 @@ dist: # archive the A4 latex -rm -r build/latex make latex PAPER=a4 + -sed -i 's/makeindex/makeindex -q/' build/latex/Makefile (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2 @@ -150,6 +151,7 @@ dist: # archive the letter latex rm -r build/latex make latex PAPER=letter + -sed -i 's/makeindex/makeindex -q/' build/latex/Makefile (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2 diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 7874415f52..0a885983d6 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -21,7 +21,7 @@ setup script). Indirectly provides the :class:`distutils.dist.Distribution` and .. function:: setup(arguments) The basic do-everything function that does most everything you could ever ask - for from a Distutils method. See XXXXX + for from a Distutils method. The setup function takes a large number of arguments. These are laid out in the following table. diff --git a/Doc/distutils/extending.rst b/Doc/distutils/extending.rst index 972ff02c03..5a70d031cc 100644 --- a/Doc/distutils/extending.rst +++ b/Doc/distutils/extending.rst @@ -15,8 +15,8 @@ want to modify existing commands; many simply add a few file extensions that should be copied into packages in addition to :file:`.py` files as a convenience. -Most distutils command implementations are subclasses of the :class:`Command` -class from :mod:`distutils.cmd`. New commands may directly inherit from +Most distutils command implementations are subclasses of the +:class:`distutils.cmd.Command` class. New commands may directly inherit from :class:`Command`, while replacements often derive from :class:`Command` indirectly, directly subclassing the command they are replacing. Commands are required to derive from :class:`Command`. diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 30bd1c2959..5cf3aee4c4 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -160,9 +160,9 @@ Glossary must be a duck.") By emphasizing interfaces rather than specific types, well-designed code improves its flexibility by allowing polymorphic substitution. Duck-typing avoids tests using :func:`type` or - :func:`isinstance`. (Note, however, that duck-typing can be complemented - with abstract base classes.) Instead, it typically employs :func:`hasattr` - tests or :term:`EAFP` programming. + :func:`isinstance`. (Note, however, that duck-typing can be complemented + with :term:`abstract base class`\ es.) Instead, it typically employs + :func:`hasattr` tests or :term:`EAFP` programming. EAFP Easier to ask for forgiveness than permission. This common Python coding diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index e8fe81b7b4..15a6616029 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -235,6 +235,14 @@ Supported operations: | ``abs(t)`` | equivalent to +\ *t* when ``t.days >= 0``, and| | | to -*t* when ``t.days < 0``. (2) | +--------------------------------+-----------------------------------------------+ +| ``str(t)`` | Returns a string in the form | +| | ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D | +| | is negative for negative ``t``. (5) | ++--------------------------------+-----------------------------------------------+ +| ``repr(t)`` | Returns a string in the form | +| | ``datetime.timedelta(D[, S[, U]])``, where D | +| | is negative for negative ``t``. (5) | ++--------------------------------+-----------------------------------------------+ Notes: @@ -250,6 +258,16 @@ Notes: (4) -*timedelta.max* is not representable as a :class:`timedelta` object. +(5) + String representations of :class:`timedelta` objects are normalized + similarly to their internal representation. This leads to somewhat + unusual results for negative timedeltas. For example: + + >>> timedelta(hours=-5) + datetime.timedelta(-1, 68400) + >>> print(_) + -1 day, 19:00:00 + In addition to the operations listed above :class:`timedelta` objects support certain additions and subtractions with :class:`date` and :class:`datetime` objects (see below). -- 2.50.1