Exception handling with NameError

Zeynel azeynel1 at gmail.com
Fri Nov 5 12:59:38 EDT 2010


Hello,

I want to append new input to list SESSION_U without erasing its
content. I try this:

...
        try:
            SESSION_U.append(UNIQUES)
        except NameError:
            SESSION_U = []
            SESSION_U.append(UNIQUES)
...
I would think that at first try I would get the NameError and
SESSION_U list would be created and appended; the second time try
would work. But it does not. Do you know why?



More information about the Python-list mailing list