[Python-checkins] cpython (3.4): Closes #16155: fix a few errors in doctest output of the FAQ pages.

georg.brandl python-checkins at python.org
Mon Oct 6 17:51:59 CEST 2014


https://hg.python.org/cpython/rev/96eab476d45e
changeset:   92859:96eab476d45e
branch:      3.4
parent:      92854:1439619daf42
user:        Georg Brandl <georg at python.org>
date:        Mon Oct 06 17:51:09 2014 +0200
summary:
  Closes #16155: fix a few errors in doctest output of the FAQ pages.

files:
  Doc/faq/design.rst  |   2 +-
  Doc/faq/general.rst |  19 +++++++++++++++----
  Doc/faq/windows.rst |   2 +-
  3 files changed, 17 insertions(+), 6 deletions(-)


diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst
--- a/Doc/faq/design.rst
+++ b/Doc/faq/design.rst
@@ -49,7 +49,7 @@
 Users are often surprised by results like this::
 
     >>> 1.2 - 1.0
-    0.199999999999999996
+    0.19999999999999996
 
 and think it is a bug in Python.  It's not.  This has little to do with Python,
 and much more to do with how the underlying platform handles floating-point
diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst
--- a/Doc/faq/general.rst
+++ b/Doc/faq/general.rst
@@ -415,14 +415,25 @@
 remember the methods for a list, they can do something like this::
 
    >>> L = []
-   >>> dir(L)
-   ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
+   >>> dir(L) # doctest: +NORMALIZE_WHITESPACE
+   ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
+   '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
+   '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',
+   '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__',
+   '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
+   '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__',
+   '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear',
+   'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
    'reverse', 'sort']
+   >>> [d for d in dir(L) if '__' not in d]
+   ['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
+
    >>> help(L.append)
    Help on built-in function append:
-
+   <BLANKLINE>
    append(...)
-       L.append(object) -- append object to end
+       L.append(object) -> None -- append object to end
+   <BLANKLINE>
    >>> L.append(1)
    >>> L
    [1]
diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst
--- a/Doc/faq/windows.rst
+++ b/Doc/faq/windows.rst
@@ -78,7 +78,7 @@
     >>> print("Hello")
     Hello
     >>> "Hello" * 3
-    HelloHelloHello
+    'HelloHelloHello'
 
 Many people use the interactive mode as a convenient yet highly programmable
 calculator.  When you want to end your interactive Python session, hold the Ctrl

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list