Content-Length: 275677 | pFad | https://github.com/python/cpython/issues/119838

ad Treat Fraction as a real value in mixed arithmetic operations with complex · Issue #119838 · python/cpython · GitHub
Skip to content

Treat Fraction as a real value in mixed arithmetic operations with complex #119838

Description

@serhiy-storchaka

In arithmetic operations, if one of operands is a Fraction, and the other operand is a complex or a numbers.Complex, the fraction is implicitly converted to a complex. Third-party types implementing the numbers.Complex interface can distinguish between real and complex operands. In future we can support the mixed real-complex arithmetic also for the builtin complex type. A fraction is a real value, so it makes sense to convert it to float instead of complex in such cases.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/119838

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy