if hasattr(obj, \'attribute\'): # do somthing
vs
try: # access obj.attribute except AttributeError, e: # deal with Attr
If it's just one attribute you're testing, I'd say use hasattr. However, if you're doing several accesses to attributes which may or may not exist then using a try block may save you some typing.
hasattr
try