Skip to content

type-comparison (E721) only works on some builtin classes and nothing else #6465

Closed
@DetachHead

Description

@DetachHead
def asdf(value: object):
    type(value) is str  # error
    type(value) is int  # error
    type(value) is list  # no error
    type(value) is dict  # no error

    class Foo:
        ...

    type(value) is Foo  # no error

pylint's unidiomatic-typecheck detects all of these cases

Metadata

Metadata

Assignees

Labels

ruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions