robwolfe <[EMAIL PROTECTED]> added the comment:

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.

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4246>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to