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: scope error
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: abdullah patel, mark.dickinson, r.david.murray, terry.reedy
Priority: normal Keywords:

Created on 2017-10-04 12:33 by abdullah patel, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pythonerror.jpg abdullah patel, 2017-10-04 12:33 jpg
Messages (4)
msg303682 - (view) Author: abdullah patel (abdullah patel) Date: 2017-10-04 12:33
there should be an error when this code is run. as  I have not defined the arguments (I was told by my computer science teacher that it should not work in theory) and parameters but it clearly works.
msg303689 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2017-10-04 13:42
The code looks fine to me; I don't see any reason to expect an error.

What error were you expecting, and why?
msg303710 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-10-04 16:48
Yes, this conforms to Python's namespace/scoping rules: nested scopes are allowed to reference (but not assign to) variables from the global scope even without a 'global' declaration.
msg303721 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-10-04 17:48
Abdullah, in the future, please upload or post runnable Python code, not an image.  Output can be copied into a message.  If you think IDLE is doing something wrong, test by running the code directly with Python.  If your file is test.py, enter the following on a Command Prompt command line.
path-to-your-python-code-dir> python -m test.py

There would only be an IDLE issue (and then only maybe) if the code ran differently or produced different output in IDLE than with python directly.  That is not the case here.
History
Date User Action Args
2022-04-11 14:58:53adminsetgithub: 75869
2017-10-04 17:48:23terry.reedysetassignee: terry.reedy ->
messages: + msg303721
components: + Interpreter Core, - IDLE
2017-10-04 16:48:23r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg303710

resolution: not a bug
stage: resolved
2017-10-04 13:42:39mark.dickinsonsetnosy: + mark.dickinson
messages: + msg303689
2017-10-04 12:33:34abdullah patelcreate