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: Function Bug?
Type: Stage:
Components: Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: rezashahrzad, steven.daprano
Priority: normal Keywords:

Created on 2014-08-15 00:15 by rezashahrzad, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
List_Error.py rezashahrzad, 2014-08-15 00:15
Uncertainty.docx rezashahrzad, 2014-08-15 00:15
Messages (3)
msg225326 - (view) Author: Reza Shahrzad (rezashahrzad) Date: 2014-08-15 00:15
Hi,

I hope this e-mail will get to the right person/department and looked at.

Thank you,

Reza Shahrzad
msg225327 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2014-08-15 00:29
Thank you for the extensive examples, but I'm afraid this is not a bug.

In your code, "result" is a local variable, which means it only exists inside the fib() function. When you try inspecting "result", it fails because there is no global variable "result".

Try doing this instead:

result = fib(100)
result
result[3]


and it should work as you expect. (By the way, it doesn't matter if the local variable inside the fib() function and the global variable are different names or the same, in both cases they are considered different.)
msg225355 - (view) Author: Reza Shahrzad (rezashahrzad) Date: 2014-08-15 18:00
Hi Steve,

Thank you very much for your prompt reply, explanation and the concise
resolution included.

I guess, it will be a while before I can hope to find any real bugs in
Python and that is something a beginner such as myself should only be
grateful for!

Thanks again,

Respectfully,

Reza Shahrzad
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66398
2014-08-15 18:00:49rezashahrzadsetmessages: + msg225355
2014-08-15 00:30:36steven.dapranosetstatus: open -> closed
2014-08-15 00:29:59steven.dapranosetresolution: not a bug

messages: + msg225327
nosy: + steven.daprano
2014-08-15 00:15:09rezashahrzadcreate