On Wed, Dec 11, 2013 at 8:30 PM, Jurko Gospodnetić <jurko.gospodne...@pke.hr> wrote: > Also, you can not test whether an object has an attribute when using the > object.attribute access method without raising/catching an exception and > then it can be hard to make sure no other code caused the exception.
It's pretty easy to make sure no other code caused the exception - just have no other code inside the try block. x.foo(input().split(" ")[4]) # Might throw from any point in the expression try: func = x.foo except AttributeError: deal_with_error func(......) ChrisA -- https://mail.python.org/mailman/listinfo/python-list