Camellia breakfastea at gmail.com
Thu Nov 9 15:37:55 CET 2006

hi all

why it generates an "UnboundLocalError" when I do the following:

def main():
    number = number()
    number_user = user_guess()
    while number_user != number:
        check_number(number = number, number_user = number_user)
        number_user = user_guess()

UnboundLocalError: local variable 'number' referenced before assignment

I found when I changed the number() to num() or whatever the issue
but doesn't every function has its own namespace?
Can anyone please explain it to me?


More information about the Python-list mailing list