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: documentation have wrong info about fibo module examples
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: christian.heimes, docs@python, eric.araujo, ezio.melotti, juanbaio10, mdk, willingc
Priority: normal Keywords:

Created on 2019-01-04 11:02 by juanbaio10, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg332967 - (view) Author: Juan (juanbaio10) Date: 2019-01-04 11:02
The below sections in modules documentation have wrong information about fibo module:
6. Modules
6.1. More on Modules
6.1.1. Executing modules as scripts
6.3. The dir() Function

The name of module is Fibo not fibo and the attributes are fab,fab2 not fib,fib2.


root@archlinux ~]# python2 --version
Python 2.7.15
[root@archlinux ~]# pip2 --version
pip 18.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@archlinux ~]# pip2 install fibo
Collecting fibo
  Using cached https://files.pythonhosted.org/packages/24/50/e74bd48bbef1040afb01b107e6cfbc3c1e991be24c10c40a37e335383e54/Fibo-1.0.0.tar.gz
Installing collected packages: fibo
  Running setup.py install for fibo ... done
Successfully installed fibo-1.0.0
[root@archlinux ~]# pip2 list modules |grep -i fibo
Fibo         1.0.0  
[root@archlinux ~]# python2
Python 2.7.15 (default, Jun 27 2018, 13:05:28) 
[GCC 8.1.1 20180531] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fibo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named fibo
>>> import Fibo
>>> Fibo.fib(10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'fib'
>>> Fibo.fib2(10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'fib2'
>>> Fibo.fab(10)
1
1
2
3
5
8
13
21
34
55
>>> Fibo.fab2(10)
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
>>> Fibo.__name__
'Fibo'
>>> dir(Fibo)
['Fab', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'fab', 'fab2', 'fab4']
msg332969 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2019-01-04 11:11
The documentation examples are not based on the 3rd party Fibo Python package. All examples are based on the short script https://docs.python.org/3/tutorial/modules.html?highlight=fibo#modules :

  For instance, use your favorite text editor to create a file
  called fibo.py in the current directory with the following contents
History
Date User Action Args
2022-04-11 14:59:09adminsetgithub: 79836
2019-01-04 11:11:22christian.heimessetstatus: open -> closed

nosy: + christian.heimes
messages: + msg332969

resolution: not a bug
stage: resolved
2019-01-04 11:02:42juanbaio10create