Feb-07-2024, 03:51 PM
(This post was last modified: Feb-07-2024, 03:51 PM by deanhystad.)
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 functionThere 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.