Check if variable is defined

Todd A. Jacobs nospam at codegnome.org
Thu May 17 09:50:57 CEST 2001


I'm having a lot of trouble doing something that was simple in Perl:
specifically, I want to create if/else clauses that take action only if a
particular variable is undefined. How do I check to see if a variable or
object has already been defined?

If there's no better way, I suppose I could try to catch the exception,
but that seems like a bit of a kludge, especially if I have to create the
exception in order to find out what exception the interpreter throws
first.

-- 
Todd A. Jacobs
CodeGnome Consulting, LTD






More information about the Python-list mailing list