Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unbounded variable
#4
Quote:I am unfamiliar with dis module.so I did not understand the blue sections of your reply.
You can read all about the python disassembler here:
https://docs.python.org/3/library/dis.html

Quote:why the error is not created in main1 function
There are no assignments in main1, so main1 doesn't make a local variable. This would generate an error
def main1():
    print(take_sum) 
If you didn't have a function named "take_sum" in the global namespace. When accessing variables python first looks local, then enclosed, global and finally built-in.
Reply


Messages In This Thread
unbounded variable - by akbarza - Feb-06-2024, 12:34 PM
RE: unbounded variable - by deanhystad - Feb-06-2024, 02:00 PM
RE: unbounded variable - by akbarza - Feb-07-2024, 11:58 AM
RE: unbounded variable - by deanhystad - Feb-07-2024, 03:51 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020