Skip to content

len(Enum) error #2891

Closed
Closed
@MeGotsThis

Description

@MeGotsThis

Not sure if this is a mypy or typeshed problem.

import enum

class Letters(enum.Enum):
    A = 0
    B = 1

print(len(Letters))

Running mypy gives this error

enum-test.py:7: error: Argument 1 to "len" has incompatible type "Letters"; expected "Sized"

Running python on it gives this

2

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions