You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently setting the attributes of a derived class is not typesafe e.g.
@dataclass
class Position(TypedJsonMixin):
x : int
y : int
p = Position(3, 3)
p.x = 1.2
is still possible. Does it make sense to overwrite the setatt method of the class
currently im doing this manually like this :
def __settattr__(self, name, value):
if isinstance(value, type(getattr(self, name))):
super().__setattr__(self, name, value)
else:
print(f'Type is not matching with that of {name} which is {type(getattr(self, name))}')
im not sure if this has some drawbacks at some point
maybe it would be an option
The text was updated successfully, but these errors were encountered:
Currently setting the attributes of a derived class is not typesafe e.g.
is still possible. Does it make sense to overwrite the setatt method of the class
currently im doing this manually like this :
im not sure if this has some drawbacks at some point
maybe it would be an option
The text was updated successfully, but these errors were encountered: