Hi,
consider following example:
class A():
def __init__(self):
self.veryImportantSession = 1
a = A()
a.veryImportantSession = None # ok
# 200 lines below
a.veryImportantSessssionnnn = 2 # I wanna exception here!! It is typo!
How could I make it so, that exception will be raised it case of I will try to set member that is not set in init?
Code above won't fail when it will be executed, but gives me fun time to debug problems.
Like with str:
>>> s = "lol" >>> s.a = 1 >>> s.a = 1 Traceback (most recent call last): File "", line 1, in AttributeError: 'str' object has no attribute 'a'
Thanks!