Skip to content

Types for complex.__new__ should be any numeric type #8440

Closed
@smlerman

Description

@smlerman

The types for the arguments to complex.__new__ should be any numeric type, not just float.

c1 = complex(1, 2)
c2 = complex(1, c1)

This code is valid, but the second line reports an error that complex is incompatible with float.

def __new__(cls: type[Self], real: float = ..., imag: float = ...) -> Self: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions