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.

Author robwolfe
Recipients georg.brandl, robwolfe, terry.reedy
Date 2008-11-08.13:06:50
SpamBayes Score 0.0016857446
Marked as misclassified No
Message-id <1226149611.97.0.574320655579.issue4246@psf.upfronthosting.co.za>
In-reply-to
Content
People seem to understand that they can not use variable before
definition. But this dramatically change when they come across nested
functions. They don't understand when variable can be resolved from
outer scope and when can not, e.g:

def outer():
    x = 1
    def inner1():
        print(x)
    def inner2():
        print(x)
        # [... some instructions (maybe a lot) ...]
        x = 1

They are always confused why `inner1` works but `inner2` doesn't.
History
Date User Action Args
2008-11-08 13:06:52robwolfesetrecipients: + robwolfe, georg.brandl, terry.reedy
2008-11-08 13:06:51robwolfesetmessageid: <1226149611.97.0.574320655579.issue4246@psf.upfronthosting.co.za>
2008-11-08 13:06:51robwolfelinkissue4246 messages
2008-11-08 13:06:50robwolfecreate