Skip to content

Provide guidance on PEP 698's strict enforcement feature of typing.override #1376

@NeilGirdhar

Description

@NeilGirdhar

PEP 698 (typing.override) suggests that type-checkers provide a strict enforcement option that would mark method overrides. However, no guidance is provided about the methods __init__ and __new__. These methods are always implicit overrides (from object method). These method do not obey LSP (so their signature doesn't depend on any superclass), which means that override decoration only verifies that you haven't misspelled the method. Should they be exempt from this strict check?

(I'm not convinced one way or the other, but it would be nice to have some guidance on this.)

CC'ing @erictraut because we had a brief discussion about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: otherOther topics not covered

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions