Skip to content

Strict mode insists on @override on standard dunders #3413

Closed

Description

@gvanrossum

Describe the Bug

I turn on strict mode and get errors insisting on @override when defining method like __repr__ or __eq__, e.g.

class C:
    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

No response

Activity

  1. self-assigned this
    on May 15, 2026
  2. jorenham commented on May 15, 2026

    @jorenham
    Collaborator
  3. jorenham commented on May 15, 2026

    @jorenham
    Collaborator

    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 )

  4. gvanrossum commented on May 15, 2026

    @gvanrossum
    Author
  5. yangdanny97 commented on May 15, 2026

    @yangdanny97
    Collaborator

    I'll have a fix up for this soon :-) let's just skip dunders for now

  6. gvanrossum commented on May 15, 2026

    @gvanrossum
    Author

    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.

  7. yangdanny97 commented on May 17, 2026

    @yangdanny97
    Collaborator

    I'll have that fixed in a followup commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions