3
If I do something like:
class Foo(object):
pass
print(Foo().python)
**OUTPUT:**
AttributeError: 'Foo' object has no attribute 'python'
How can I treat this exception within my class, rather than outside it, for example:
class Foo(object):
def any_except_method():
return 'default_value'
print(Foo().python)
**OUTPUT:**
'default_value'
It worked, thank you very much @jfaccioni!
– Victor Manhani