T
Thomas Philips
If one makes a typographical error when assigning a value to an
attribute (i.e if one types ClassName.xyc = 10 instead of
ClassName.xyz=10), a new attribute xyc will be created, and the error
can later prove difficult to debug.
Is there a way to check assignments when they are made and to allow
only those that modify a restricted set of allowable attributes?
Looking through ClassName.__dict__.keys() is perhaps one way to
achieve this: Is there a simpler (i.e. more Pythonic) way to do it as
well?
Thomas Philips
attribute (i.e if one types ClassName.xyc = 10 instead of
ClassName.xyz=10), a new attribute xyc will be created, and the error
can later prove difficult to debug.
Is there a way to check assignments when they are made and to allow
only those that modify a restricted set of allowable attributes?
Looking through ClassName.__dict__.keys() is perhaps one way to
achieve this: Is there a simpler (i.e. more Pythonic) way to do it as
well?
Thomas Philips