Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9205e9e

Browse files
committed
Closes #16155: fix a few errors in doctest output of the FAQ pages.
1 parent 7fa4a8f commit 9205e9e

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

Doc/faq/design.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Why are floating-point calculations so inaccurate?
4949
Users are often surprised by results like this::
5050

5151
>>> 1.2 - 1.0
52-
0.199999999999999996
52+
0.19999999999999996
5353

5454
and think it is a bug in Python. It's not. This has little to do with Python,
5555
and much more to do with how the underlying platform handles floating-point

Doc/faq/general.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,14 +415,25 @@ while they enter their program's source in another window. If they can't
415415
remember the methods for a list, they can do something like this::
416416

417417
>>> L = []
418-
>>> dir(L)
419-
['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
418+
>>> dir(L) # doctest: +NORMALIZE_WHITESPACE
419+
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
420+
'__dir__', '__doc__', '__eq__', '__format__', '__ge__',
421+
'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',
422+
'__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__',
423+
'__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
424+
'__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__',
425+
'__sizeof__', '__str__', '__subclasshook__', 'append', 'clear',
426+
'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
420427
'reverse', 'sort']
428+
>>> [d for d in dir(L) if '__' not in d]
429+
['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
430+
421431
>>> help(L.append)
422432
Help on built-in function append:
423-
433+
<BLANKLINE>
424434
append(...)
425-
L.append(object) -- append object to end
435+
L.append(object) -> None -- append object to end
436+
<BLANKLINE>
426437
>>> L.append(1)
427438
>>> L
428439
[1]

Doc/faq/windows.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ by entering a few expressions of your choice and seeing the results::
7878
>>> print("Hello")
7979
Hello
8080
>>> "Hello" * 3
81-
HelloHelloHello
81+
'HelloHelloHello'
8282

8383
Many people use the interactive mode as a convenient yet highly programmable
8484
calculator. When you want to end your interactive Python session, hold the Ctrl

0 commit comments

Comments
 (0)