Skip to content

What to do about types from the numbers module? #2636

Closed
@gvanrossum

Description

@gvanrossum

PEP 3141 introduces a numeric tower and a corresponding module numbers defining some numeric ABCs like Integral and Real. These ABCs are ignored by PEP 484 (you just have to use int or float) but some people don't know that and in their zeal to be hyper-correct use e.g. numbers.Integral in type annotations. Then type checks fail because mypy doesn't consider int a subclass of numbers.Integral.

We should either make this work or warn about numeric ABCs when used in type annotations.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions