Skip to content

Conversation

@hamdanal
Copy link
Contributor

import cmath
class Float:
    def __float__(self): return cmath.pi
class Index:
    def __index__(self): return 1
print(cmath.rect(Float(), Index()), cmath.rect(Index(), Float()))

Outputs

(1.6974097548329732+2.643559064081456j) (-1+1.2246467991473532e-16j)

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nice catch!

@srittau srittau merged commit 6fa275f into python:main Jan 12, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants