This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 3 tutorial documentation errors
Type: behavior Stage:
Components: Documentation Versions: Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: LambertDW, ajaksu2, georg.brandl
Priority: normal Keywords:

Created on 2008-10-18 20:35 by LambertDW, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg74958 - (view) Author: David W. Lambert (LambertDW) Date: 2008-10-18 20:35
I ran doctests on the interactive session scripts from the tutorial.
Aside from finding a doctest enhancement---but there are already so 
many doctest issues tracked---I found these discrepancies using online 
tutorial and Python 3.0rc1 (r30rc1:66499, Oct 17 2008, 13:11:34)

-1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--
"doesn't" --> "does not"   Trite documentation error

http://docs.python.org/dev/3.0/tutorial/introduction.html


Time to fix the doctest EXCEPTION_DETAIL

TypeError: 'str' object doesn't support ... (multiple occurrences)

"doesn't"  became  "does not"  in release 2.4.

-2--2--2--2--2--2--2--2--2--2--2--2--2--2--2--2--2--2--2--2--2--
"coercing to Unicode" or "convert to str"?

$ p3
Python 3.0rc1 (r30rc1:66499, Oct 17 2008, 13:11:34) 
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> '2'+3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Can't convert 'int' object to str implicitly



http://docs.python.org/dev/3.0/tutorial/errors.html
>>> '2' + 2
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: coercing to Unicode: need string or buffer, int found


-3--3--3--3--3--3--3--3--3--3--3--3--3--3--3--3--3--3--3--3--3--
Integer division yields float

http://docs.python.org/dev/3.0/tutorial/errors.html

>>> divide(2, 1)    # 2.0 is correct
result is 2


-doctest---doctest---doctest---doctest---doctest---doctest--
doctest improvement possible

# execute this as sh code to exhibit problem
cat<<EOF>p.py
'''
    example from
     http://docs.python.org/dev/3.0/tutorial/introduction.html

    >>> 'doesn\'t'
    "doesn't"
'''

import doctest
doctest.testmod()
EOF
python p.py
# "\"Yes,\" he said." # likewise breaks doctest
# end of sh scripting

I suppose these issues are known.  Here's another that fails in 
doctest:
http://docs.python.org/dev/3.0/tutorial/stdlib.html

>>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
msg87951 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-05-17 02:43
David,
I hope others can understand your report, I get dizzy looking at it :)
msg87963 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-05-17 08:15
I fixed the three docs issues in r72703 and r72704.  The doctest "issue"
is not an issue; the single backslash is already removed by Python's
tokenizer, so that doctest only sees 'doesn't' which is obviously a
syntax error.  You need to duplicate the backslash, or use a raw docstring.
History
Date User Action Args
2022-04-11 14:56:40adminsetgithub: 48394
2009-05-17 08:15:46georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg87963
2009-05-17 02:43:32ajaksu2setpriority: normal

type: behavior
assignee: georg.brandl
components: + Documentation
versions: + Python 3.1, - Python 3.0
nosy: + ajaksu2, georg.brandl

messages: + msg87951
2008-10-18 20:35:03LambertDWcreate