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
{{ message }}
Repository navigation
Strict mode insists on @override on standard dunders #3413
I turn on strict mode and get errors insisting on @override when defining method like __repr__ or __eq__, e.g.
classC:
def__repr__(self):
return"C()"
puts red wiggles on __repr__ that insist on adding @override.
While technically true (object.__repr__ exists) it is plain silly to flag this usage. Adding @overload here does not help program correctness or readability, it is pure noise. It makes strict mode useless for me.
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
Thanks! That looks like a stopgap, it should really only skip dunders that exist on object and are directly inherited directly from there. But thanks nevertheless.
Activity
jorenham commentedon May 15, 2026
note that basedpyright also requires an
@overridedecorator in this case: https://basedpyright.com/?typeCheckingMode=strict&reportUnannotatedClassAttribute=false&code=MYGwhgzhAEDCBcAoaLoBMCmAzaB9XAThgA4H4AUEGIWAlEqo9EQC4CuBAdtAESzm0eQAjorenham commentedon May 15, 2026
If I remember correctly, Java also does this for the methods like
equals(not that Java is a such a great example of language design or anything :P )gvanrossum commentedon May 15, 2026
yangdanny97 commentedon May 15, 2026
I'll have a fix up for this soon :-) let's just skip dunders for now
gvanrossum commentedon May 15, 2026
Thanks! That looks like a stopgap, it should really only skip dunders that exist on
objectand are directly inherited directly from there. But thanks nevertheless.skip dunder for missing override decorator check
yangdanny97 commentedon May 17, 2026
I'll have that fixed in a followup commit
only skip missing override decorator for dunders inherited from object