Hello ,
I have had a little surprise and maybe because I haven't read the manual well enough or can't understand all the underlying details.
Imagine a small class and another file's main using an instance of that class. If I try to modify (not define !) an INEXISTANT attribute of the class in a try..except, i will get the print outs in except because the attribute doesn't exists, but how do i recover the message which indicates why the statement jumped to the except part?
class incomplete:
def __init__(self):
self.first = 1
self.second = 2
i = incomplete()
try:
print i.first
print i.second
i.third += 3
print i.third + i.first
except:
print 'in exception'
Prints out
1
2
in exception
Any ideas please?
Thanks,
T