Skip to content

report an error when assigning a default value to self or cls #3729

@DetachHead

Description

@DetachHead
class Foo:
    def foo(self=1): ...

this is almost certainly a mistake, so it should be reported as an error

maybe related: #3666, but i think this should always be an error, regardless of whether the default value is the correct type

basedpyright has a rule for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedLarger than "good first issue", but still well-defined and ready for someone to pick uptypechecking
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions