Brown, Rodrick wrote:
How could I do the following check in PythonIn Perl I could do something like if ((defined($a)) { ... } I tried if var is not None: However this doesn't seem to work as described. Thanks.
try/except
Or look up the attribute in the appropriate dictionary(ies).
def test():
newvar = 42
if "newvar" in locals():
print "yes"
DaveA
--
http://mail.python.org/mailman/listinfo/python-list
