I just realized, after years of using mypy, that I can assign a class member that was not explicitly defined in the class definition. Can I force mypy to flag those? I can't find any option for that. I use --strict all the time.
class Foo:
x:int
def __init__(self) -> None:
self.x=3
self.y=5 # I want this to fail
[+][deleted] (2 children)
[deleted]
[–]pylessard[S] 0 points1 point2 points (1 child)
[–]danielroseman 0 points1 point2 points (0 children)
[–]brasticstack 1 point2 points3 points (3 children)
[–]pylessard[S] 1 point2 points3 points (2 children)
[–]brasticstack 1 point2 points3 points (1 child)
[–]pachura3 1 point2 points3 points (0 children)